-
Notifications
You must be signed in to change notification settings - Fork 153
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: Fix fractionalSecondDigits behaviour in Duration.toString() #1956
Conversation
Draft until presented at TC39. cc @rkirsling |
Codecov Report
@@ Coverage Diff @@
## main #1956 +/- ##
=======================================
Coverage 94.96% 94.96%
=======================================
Files 19 19
Lines 10967 10967
Branches 1743 1743
=======================================
Hits 10415 10415
Misses 535 535
Partials 17 17
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
0cf44aa
to
1690ed4
Compare
This achieved consensus at the December 2021 TC39 meeting. |
Previously, code that combined zero subsecond units with a specified precision, such as the following: Temporal.Duration.from({ years: 3 }).toString({ fractionalSecondDigits: 5 }) would not render the seconds with the correct precision. The above example would return 'P3Y' and not 'P3YT0.00000S'. Closes: #1763
1690ed4
to
228f183
Compare
tc39/proposal-temporal#1956 clarified that the fractionalSecondDigits and smallestUnit options to Temporal.Duration.p.toString() specified the exact number of digits after the decimal point, no more and no less. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
tc39/proposal-temporal#1956 clarified that the fractionalSecondDigits and smallestUnit options to Temporal.Duration.p.toString() specified the exact number of digits after the decimal point, no more and no less. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
tc39/proposal-temporal#1956 clarified that the fractionalSecondDigits and smallestUnit options to Temporal.Duration.p.toString() specified the exact number of digits after the decimal point, no more and no less. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
tc39/proposal-temporal#1956 clarified that the fractionalSecondDigits and smallestUnit options to Temporal.Duration.p.toString() specified the exact number of digits after the decimal point, no more and no less. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
https://bugs.webkit.org/show_bug.cgi?id=240193 Reviewed by Yusuke Suzuki. This patch implements the spec correction of tc39/proposal-temporal#1956: `new Temporal.Duration.from(1).toString({ fractionalSecondDigits: 2 })` should be P1Y0.00S, not just P1Y. * stress/temporal-duration.js: Add a test case. * test262/expectations.yaml: Mark two test cases as passing. * runtime/TemporalDuration.cpp: (JSC::TemporalDuration::toString): Canonical link: https://commits.webkit.org/250388@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Previously, code that combined zero subsecond units with a specified
precision, such as the following:
Temporal.Duration.from({ years: 3 }).toString({ fractionalSecondDigits: 5 })
would not render the seconds with the correct precision. The above example
would return 'P3Y' and not 'P3YT0.00000S'.
Closes: #1763