FireFox 34 setMinutes BUG?

There is a strange behavior of the dateFinFlow method 34 setMinutes for setting 60 minutes for 2008 January 01 23 hours 00 minutes 00 seconds. This is expected to increase the day, but it is not.

var initDate = [2008, 0, 1]; var d = new Date(initDate[0], initDate[1], initDate[2]); document.body.innerHTML += d + "<br/>"; d.setHours(23); d.setMinutes(60); document.body.innerHTML += d + "<br/>"; 

Result of FireFox 34:

 Tue Jan 01 2008 00:00:00 GMT+0300 (Russia TZ 2 Standard Time) Tue Jan 01 2008 23:00:00 GMT+0300 (Russia TZ 2 Standard Time) 

instead of Chrome 39.0.2171.71 m:

 Tue Jan 01 2008 00:00:00 GMT+0300 (Russia TZ 2 Standard Time) Wed Jan 02 2008 01:00:00 GMT+0400 (Russia TZ 2 Daylight Time) 

If I change the year to 2006, the result will be agreed:

 Sun Jan 01 2006 00:00:00 GMT+0300 (Russia TZ 2 Standard Time) Mon Jan 02 2006 00:00:00 GMT+0300 (Russia TZ 2 Standard Time) 

http://jsfiddle.net/7dp8xvf8/1/

This is mistake?

UPDATE: IE 8 and 9 have the same behavior, but 10-11 are fine.

+7
javascript date firefox time
source share
2 answers

Given the spec , I believe this is really intended behavior. In particular, note that the MakeTime function does not contain overflow checks (i.e., it does not determine whether the number of minutes is less than 60). The MakeDate function behaves similarly; therefore, Firefox does indeed comply with the specification.

0
source share

This works for me in Firefox 39.0.3, as well as in the current build (42a), as I get:

 "Tue Jan 01 2008 00:00:00 GMT+0300 (MSK)" "Wed Jan 02 2008 00:00:00 GMT+0300 (MSK)" 

It also requires an ES specification.

If this still doesn't work for you (which would be surprising), and especially if you see the time zone weirdness, you should also specify your TZ system settings.

0
source share

All Articles