JavaScript Spec Change on Date Time Zone Default
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?
- ECMA-262 5.1 edition, June 2011 says it should assume Z
- ECMA-262, 6th edition, June 2015 says it should assume local time.
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() );