Date Object IE,FF follow ECMAScript Spec and Chrome Doesn’t
In the developer console of any of your browser type
new Date('01/01/01') |
The correct answer should be (ignore the timezone, you might get a different one)
Tue Jan 01 1901 00:00:00 GMT-0600 (Central Standard Time) |
Strangely chrome gives the following answer
Mon Jan 01 2001 00:00:00 GMT-0600 (Central Standard Time) |
The initial reaction of any developer is that chrome is correct and IE is wrong, however according the ECMAScript spec
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-date.utc
If y is not NaN and 0 ≤ ToInteger(y) ≤ 99, let yr be 1900+ToInteger(y); otherwise, let yr be y. |
So the lesson I learnt from this experience is not to take the side of any browser before doing the due investigation.
“Even today Browsers are consistently inconsistent”
-Rushi
-Rushi