andrewplummer/Sugar — Issue #98: Weird problem when parsing dates: different result depending on the current day for the same string
Author: jorgemanrubia
Created: 2012-02-01 18:40:46+00:00
State: open

Hi,

Today we experienced a very weird problem with suggar.js. During a period of time, we observed a general problem in the way the dates in our app worked. We debugged the problem, and realized that during the day "31st of January" sugar.js didn't parse dates correctly.

You can simulate this problem by changing the current day in your operating system.

today = 15 february (everything is fine, 2011-09... is parsed as september)

> Date.create('2011-09-01T05:00:00Z').toString()
"Thu Sep 01 2011 01:00:00 GMT-0400 (EDT)"

today = 30 february (2011-09... is parsed as october)

> Date.create('2011-09-01T05:00:00Z').toString()
"Sat Oct 01 2011 01:00:00 GMT-0400 (EDT)"

today = 31 february (2011-09... is parsed as august)

> Date.create('2011-09-01T05:00:00Z').toString()
"Mon Aug 01 2011 01:00:00 GMT-0400 (EDT)"

We updated to the last version of sugar.js but the problem persists.

Any help with this issue would be appreciated.

Regards