js-temporal / proposal-temporal-v2

Future additions to Temporal
MIT License
24 stars 1 forks source link

Increased fractional precision in Duration strings #26

Open ptomato opened 2 years ago

ptomato commented 2 years ago

(Moved from https://github.com/tc39/proposal-temporal/issues/1712)

Temporal.Duration strings are currently allowed to specify fractional hours, minutes, and seconds, up to 9 digits.

Advantages:

Example strings that are currently rejected by Temporal.Duration.from(), that nonetheless represent exact numbers of nanoseconds:

Concerns:

Increasing the allowed precision beyond 9 digits for fractional seconds, 10 digits for fractional minutes, or 11 digits for fractional hours, may pose implementation difficulties since implementations would have to calculate with fractional nanoseconds.

Prior art:

Constraints / corner cases: