-
Notifications
You must be signed in to change notification settings - Fork 67
Remove Date.UTC after tc39/ecma262#642 is merged #31
Comments
You just missed the very beginning of the section you pointed to:
|
According to my tests, in general, Chakra does not always return NaN when calling Date.UTC with less than two arguments. More precisely, it seems to implement the following variation of the Date.UTC algorithm:
which is observable only when less than two arguments are provided. |
It would be nice to get implementations to agree on what should happen when
|
Chakra implements it differently (#31 (comment)), so this quirk doesn’t seem required for web compatibility. Ref. #29 (comment).
@bterlson What are your thoughts here? |
As usual I agree with @mathiasbynens about what would be nice. I can't imagine that this is important for compat scenarios (certainly not missing year, though I could possibly imagine missing month). I'll open a bug on ChakraCore to align with the others here. |
Let's repurpose this bug to remove the JavaScript Standard's line about Date.UTC once tc39/ecma262#642 is merged. |
Oh, nevermind, I guess this was already removed in 750a6d7. |
Well, we still don't have consensus on TC39 to standardize returning NaN for Date.UTC with one argument. It would seem nice to write it down somewhere that that returns NaN. |
@littledan @bterlson At this time, is it worth implementing the behavior that 0 args should return NaN while we wait for consensus on the 1 argument option, or is a decision forthcoming? |
From an implementor's point or view, I think it would be fine to ship the consensus from other browsers (0 or 1 arguments returns NaN) to maximize compatibility even if the committee allows something more general. |
We have no guarantee when a further decision on Date.UTC will come FWIW. It may be a while. |
Maybe I am wrong, but I tried to follow to spec along here. (https://tc39.github.io/ecma262/#sec-date.utc)
For zero arguments:
Date.UTC
MakeDay(yr, m, dt)
MakeDate
TimeClip
For one argument MakeDay should also return NaN, because month is not finite, so the rest follows.
The text was updated successfully, but these errors were encountered: