-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Integrate Intl.DurationFormat into Temporal #3088
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3088 +/- ##
==========================================
- Coverage 96.37% 96.14% -0.24%
==========================================
Files 21 21
Lines 9874 9928 +54
Branches 1800 1801 +1
==========================================
+ Hits 9516 9545 +29
- Misses 311 336 +25
Partials 47 47 ☔ View full report in Codecov by Sentry. |
ToIntegerIfIntegral no longer needs to be defined by Temporal, as it's now part of ECMA-402. However, when Temporal becomes part of ECMA-262, we do need to move ToIntegerIfIntegral into ECMA-262. Remove it from abstractops.html and put it in an <ins> block in mainadditions.html, and in a <del> block in intl.html.
ToIntegerIfIntegral no longer needs to be defined by Temporal, as it's now part of ECMA-402. However, when Temporal becomes part of ECMA-262, we do need to move ToIntegerIfIntegral into ECMA-262. Put it in a <del> block in intl.html. We can keep the new definition in its current place in the spec while adjusting its ID.
DurationSign no longer needs to be defined by Temporal, as it's now part of ECMA-402. However, when Temporal becomes part of ECMA-262, we do need to move Duration#to ECMA-262. Put it in a <del> block in intl.html. We can keep the new definition in its current place in the spec while adjusting its ID. Once Temporal.Duration objects are introduced, there is no longer any need for Duration Records. So, make the ECMA-402 DurationSign accept a Temporal.Duration object (as it already did in Temporal), delete the ToDurationRecord operation and the Duration Record definition, and change several other operations from ECMA-402 to use Temporal.Duration objects instead of Duration Records. Temporarily, since these operations aren't yet in ecma402-biblio pending tc39/ecma402#943, add a JSON bibliography file so the references aren't dangling.
0b11e62
to
2736777
Compare
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!
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 except for the comment already made by anba.
This operation had a placeholder note until the Intl.DurationFormat proposal would reach stage 4. Now that the proposal is stage 4, we can replace the placeholder note with the real implementation. Closes: #452
The previous implementation in the reference code was non-conformant on hosts with Intl.DurationFormat implemented without Temporal.Duration integration. On those hosts, the argument to format() would be treated as a Duration-like property bag and its properties would be observably read, even if it was a Temporal.Duration. The correct behaviour would be to get the information from the Temporal.Duration object's internal slots.
An additional modification to ECMA-402 that Temporal makes, is for DurationFormat.p.format and formatToParts to accept a Temporal.Duration object as input. This monkeypatches those methods to conform to that requirement.
2736777
to
cf54568
Compare
Intl.DurationFormat is stage 4, so we can now incorporate the necessary changes to use it in Temporal.Duration.prototype.toLocaleString and to accept Temporal.Duration as an argument to Intl.DurationFormat.prototype.format and formatToParts. Some operations need to move from ECMA-402 into ECMA-262.
Closes: #452