You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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?
The text was updated successfully, but these errors were encountered:
This wording goes back to ES1, and we don't know exactly what was intended when it was written, although it actually predates the requirement to accept the Date Time String Format grammar and as such was originally the only input implementations were told to accept. Also note that ES1 was published only a few months after RFC 2119.
The current editors believe the intention was to make this a normative requirement.
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: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:
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 returnNaN
?The text was updated successfully, but these errors were encountered: