Description
Opening this issue in response to tc39/test262#4382 (comment). See also #1374.
I'd like to have a better understanding of what exactly the current normative requirements for Date.parse()
are. It starts out pretty clear, emphasis mine:
The function first attempts to parse the String according to the format described in Date Time String Format (21.4.1.32), including expanded years. If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Strings that are unrecognizable or contain out-of-bounds format element values shall cause this function to return NaN.
This sounds like only supporting the Date Time String Format is a normative requirement. There is more prose after this that mentions a special case:
If x is any Date whose milliseconds amount is zero within a particular implementation of ECMAScript, then all of the following expressions should produce the same numeric value in that implementation, if all the properties referenced have their initial values:
x.valueOf() Date.parse(x.toString()) Date.parse(x.toUTCString()) Date.parse(x.toISOString())However, the expression
Date.parse(x.toLocaleString())is not required to produce the same Number value as the preceding three expressions and, in general, the value produced by this function is implementation-defined when given any String value that does not conform to the Date Time String Format (21.4.1.32) and that could not be produced in that implementation by the toString or toUTCString method.
How are should and could supposed to be interpreted here? More specifically, is Date.parse("Thu, 01 Jan 1970 00:00:00 GMT") === 0
a normative requirement or may it return NaN
?