JavaScript Spec Change on Date Time Zone Default

By Xah Lee. Date: .

JavaScript spec changed on its datetime string format in 2015.

when you have a date string missing the time zone, example:

(new Date("2014-12-31T23:08")).getHours()

what is the assumed time zone?

js spec 2011 time z zNnZP
ECMA-262 5.1 edition, June 2011 [https://262.ecma-international.org/5.1/#sec-15.9.1.15]
js spec 2015 time z c9R4T
ECMA-262, 6th edition, June 2015 [https://262.ecma-international.org/6.0/#sec-date-time-string-format]

As of 2015-04-11, 2016-04-26, 2016-12-13,

(new Date("2014-12-31T23:08")).getHours()

, Firefox returns 23 (which is assuming local time), Chrome assumes Z and returns 15 or other value.

As of 2022-07-28, chrome, Firefox, all assume local time.

console.log( (new Date("2014-12-31T23:08")).getHours() );

JavaScript Spec Reading