Consider this snippet using the latest MooTools Core & More 1.5 (view in jsFiddle):
console.log(new Date().parse('2014-09-20 00:00:00'));
When I run this code, I usually get something along the lines of
Sat Sep 20 2014 00:00:00 GMT+0200 (Central Europe Daylight Time)
However, when I use Chrome (38.0.2125.104 m) or a PyQt 4 WebKit window and use a Russian time zone (anything in Windows with an RTZ
in its name), the date is 1 month in the future:
Mon Oct 20 2014 00:00:00 GMT+0300 (Eastern Europe Daylight Time)
This apparently does not occur with Firefox or Internet Explorer, or apparently any non-Russian time zone.
Anybody know why ?
The issue is apparently caused by Chrome bugs 417640 and 420269.
Dates between 2014-01-01 00:00:00
(inclusive) and 2014-01-01 01:00:00
(exclusive) simply do not exist as such, they resolve to 2013-12-31 23:00:00
- 2013-12-31 23:59:59
instead.
You can reproduce this with an RTZ:
var d = new Date();
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
d.setYear(2014);
d.setDate(1);
d.setMonth(0);
console.log(d.getMonth()); // Yields 11 rather than 0
This is because Date.parse('2014-01-01 00:00:00')
yields 2013-12-31
in the date part due to time zone issues.
This bug affects other dates as well because of the way MooTools' Date
extensions work (initializing dates with year-01-01 00:00:00
and then subsequently setting extracted values, e.g. 12:34:56 Sep 25, 2014
would be derived like this:
2014-01-01 00:00:00 // Initialization
2013-12-31 23:00:00 // Resolved date with RTZ
2014-12-31 23:00:00 // Year
2014-09-31 23:00:00 // Month
2014-10-01 23:00:00 // Resolved date with overflow
2014-10-25 23:00:00 // Day of month
2014-10-25 12:34:56 // Time