-
Notifications
You must be signed in to change notification settings - Fork 160
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
Fractional parts should not be limited to nine digits #1712
Comments
Previously we had decided to reject strings with more than 9 decimal places: #198 (comment) What do you propose to change? (e.g., Duration strings with hours or minutes fractions should be allowed to have more than 9 decimal places as long as they evaluate to any nonzero integer Duration components?) That seems quite fuzzy and/or unexpected for users, given that seconds with up to 9 decimal places will be the much more common input... |
I would propose allowing any fractional component in a string being deserialized to use an arbitrary number of digits and throwing a RangeError if the corresponding value cannot be represented exactly. |
That seems quite dangerous, since it could make |
"how the operation was written" is up to the specification, which should be using decimal arithmetic for such deserialization. |
But this is also not that difficult given the finite precision cutoff for resulting values. |
I see what you mean now. I'm concerned that this would be a Stage 3 change not arising from implementation experience, though. (Aside from that, I'm running out of time to prepare a presentation for the agenda deadline, since there are a lot more normative changes coming from implementors for me to work through. If the champions did decide to change this, it might have to wait for the October plenary.) |
Note that the maximum exact minute has 10 fractional digits, and hours 11 factional digits. Anything else is tricky to verify. So I vote to keep this as-is. |
Temporal champions meeting, 2022-10-27: For just 1 or 2 extra digits in fractional hour and fractional minute strings this doesn't seem worth the increased complexity for implementations. We'll propose this for a future version of Temporal instead: js-temporal/proposal-temporal-v2#26 |
"PT0.0000000001H" represents exactly 360 nanoseconds, but
Temporal.Duration.from
rejects it with a RangeError.The text was updated successfully, but these errors were encountered: