Page 1 of 1

October's Bug ?

Posted: Tue Jul 19, 2011 9:07 pm
by NoN'
Is there a strange October's Bug in LiveCode ?

Working on an old hypercard project adapted under LiveCode, I've noted the strange behavior of a script intended to calculate dates.
when I try this (in message box for instance)

Code: Select all

put "10/30/2011" into theDate
convert theDate to seconds
add "86400" to theDate
convert theDate to long date
put theDate  --- or answer the date
I obtain :

"Sunday, October 30, 2011" !!



where I should obtain "Sunday, October 31, 2011". And it's the same thing with :
  • "10/31/2010" ( 1288476000 secs )
    "10/28/2012" ( 1351375200 secs )
    "10/27/2013" ( 1382824800 secs )
    "10/26/2014" ( 1414274400 secs )
    "10/25/2015" ( 1445724000 secs )
...and before (as : 10/25/2009) and surely after. Is someone, here, could test this script on different IT environment than mine ?

Oh, a clue : all the date are sundays.

this bug, if it is one, could have adverse consequences in some cases.

NoN'
working on a new/old iMac intel, Leopard and Livecode v.4.5.3

Re: October's Bug ?

Posted: Tue Jul 19, 2011 10:04 pm
by FourthWorld
NoN' wrote:Working on an old hypercard project adapted under LiveCode, I've noted the strange behavior of a script intended to calculate dates.
when I try this (in message box for instance)

Code: Select all

put "10/30/2011" into theDate
convert theDate to seconds
add "86400" to theDate
convert theDate to long date
put theDate  --- or answer the date
I obtain :

"Sunday, October 30, 2011" !!



where I should obtain "Sunday, October 31, 2011".
I get "Monday, October 31, 2011" in both v4.5.3 and 4.6.2

Re: October's Bug ?

Posted: Tue Jul 19, 2011 10:05 pm
by wsamples
Running your script in the message box here returns "Monday, October 31, 2011". Livecode 4.6.2, openSUSE.

What happens if you add an hour or two hours? Are these the only dates you've found that are goofy? This appears to be related to the end of Daylight Savings Time which happens to occur on those dates in France.

Re: October's Bug ?

Posted: Tue Jul 19, 2011 10:39 pm
by NoN'
Richard, WSamples,

Thank you for your answers and for the test.

@wsamples :

thank you for this light. I ignored the problem of "the end of Daylight Savings Time " in France.
So, as you have suggested to me, I've tried by adding two additional hours and... it works fine now.

Code: Select all

put "10/30/2011" into theDate
convert theDate to seconds
add "93600" to theDate
convert theDate to long date
put theDate
retun : "Monday, October 31, 2011"

Thanks again

Renaud