-
Notifications
You must be signed in to change notification settings - Fork 107
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
Normative: Make DefaultNumberOption truncate before validating range #908
Conversation
… to align with toFixed in ECMA-262
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.
Thanks!
From a normative perspective, this seems to go against our normative convention for rejecting non-integral arguments where we expect integers: https://github.com/tc39/how-we-work/blob/main/normative-conventions.md#integral-number-taking-inputs-should-reject-non-integral-arguments. Why isn't this just throwing a RangeError for these invalid inputs? |
Does that mean Temporal should be changed to avoid ToIntegerWithTruncation?
We can't really change This PR only allows two more possible inputs:
|
Co-authored-by: Michael Ficarra <[email protected]>
I'll put in a link to the plenary's conclusions on this PR once the notes are up on GitHub, but in the meantime here's a summary:
|
Currently the behaviour of ECMA-402 differs from ECMA-262 in that 402's
DefaultNumberOption
validates that the value passed in is within the specified range before truncating that value, whereas 262'stoFixed
truncates before range validation. This PR changes 402 to align with 262. See #691, also tc39/proposal-temporal#2296