-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date.UTC should return NaN for out-of-range time value #4615
Conversation
According to spec Section 20.3.3.4, if the time value is larger than ktvMax or smaller than ktvMin, then Date.UTC should return NaN rather than return the actual value. Also updated the link at L1645 to #1665: "Date.UTC(x) [single-argument case] semantics update".
/cc @dilijev @bterlson @obastemur Please review. Also should I target this to master, release/1.8 or release/1.9? |
@xiaoyinl master is good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We're having issues with the commit signing service at the moment. When that is resolved I'll merge this. |
I see. Thanks for the review! |
@dotnet-bot test this please |
…ime value Merge pull request #4615 from xiaoyinl:dateUTCoverflow According to spec [Section 20.3.3.4](https://tc39.github.io/ecma262/#sec-date.utc), if the time value is larger than `ktvMax` or smaller than `ktvMin`, then `Date.UTC` should return `NaN` rather than return the actual value. Also updated the link at L1645 to #1665: "Date.UTC(x) [single-argument case] semantics update". Test case: `Date.UTC(2001, 1, 5e+9)` ChakraCore: 432000980899200000 SpiderMonkey and v8: NaN
@xiaoyinl apologies for the delay in landing this. Thanks for your contribution! |
@dilijev No problem! Thanks for landing it. |
According to spec Section 20.3.3.4, if the time value is larger than
ktvMax
or smaller thanktvMin
, thenDate.UTC
should returnNaN
rather than return the actual value.Also updated the link at L1645 to #1665: "Date.UTC(x) [single-argument case] semantics update".
Test case:
Date.UTC(2001, 1, 5e+9)
ChakraCore: 432000980899200000
SpiderMonkey and v8: NaN