The behavior you witnessed is implementation-specific, which for the one-arg Date(value)
constructor is covered by the ECMA-262 spec in chapter 20.3.2.2. Your example will walk through to step 3.b.ii.1. which states that the string will be parsed according to the rules laid out in chapter 20.3.3.2 for the Date.parse(string)
method. That method specification defines:
The function first attempts to parse the format of the String according to the rules (including extended years) called out in Date Time String Format (20.3.1.16). If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Unrecognizable Strings or dates containing illegal element values in the format String shall cause Date.parse
to return NaN.
Because your strings obviously do not comply with the Date Time String Format the browser falls back to its implementation-specific algorithm. My Chrome 70, e.g., returns a Date
object for the current time which corresponds to calling the no-args Date()
constructor. IE11 on the other hand parses the string to NaN
and returns a Date object with an "invalid date" value.