Implement Intl.DurationFormat
Categories
(Core :: JavaScript: Internationalization API, enhancement, P3)
Tracking
()
People
(Reporter: yulia, Assigned: anba)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-complete, parity-chrome, parity-safari)
Attachments
(7 files, 1 obsolete file)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Intl.durationFormat is at stage 2
Reporter | ||
Updated•5 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
"microseconds" and "nanoseconds" aren't sanctioned units for Intl.NumberFormat,
so we know have to differentiate between supported and sanctioned units.
Assignee | ||
Comment 2•3 years ago
|
||
ICU doesn't provide a public API to retrieve the time separator, so we have
to read it manually from the resource bundles.
Depends on D152743
Assignee | ||
Comment 3•3 years ago
|
||
Implements the Intl.DurationFormat
constructor, including the
resolvedOptions()
and supportedLocalesOf()
methods.
Depends on D152744
Assignee | ||
Comment 4•3 years ago
|
||
Depends on D152745
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D152746
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D152747
Assignee | ||
Comment 7•3 years ago
|
||
Depends on D152748
Assignee | ||
Comment 8•3 years ago
|
||
Depends on D152749
Assignee | ||
Comment 9•3 years ago
|
||
The proposal has been decoupled from Temporal, so this bug no longer depends on bug 1519167.
The proposal itself is at stage 3, but there are still multiple open issues which may require a different implementation approach, e.g. formatToParts
is likely to change, see https://github.com/tc39/proposal-intl-duration-format/issues/55. So maybe we should wait a bit longer until the major open issues have been resolved.
When writing the patches, I had to resort to hacks at two points:
- Formatting microseconds and nanoseconds units through
Intl.NumberFormat
isn't currently possible, so I had to bypass the check for valid unit identifiers. https://github.com/tc39/ecma402/issues/702 should help to avoid this hack. - I had to be creative in
formatToParts
when digital formatting is used (e.g."02:00:00.123"
). The aforementionedformatToParts
changes may require more hacks aroundIntl.ListFormat
.
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 10•2 years ago
|
||
I've updated the WIP patches to match the current spec proposal text. Not quite yet ready for review, because there are still some open PRs which should land first.
Comment 11•2 years ago
|
||
There was an update about this proposal in the ECMA-402 meeting today. Ujjwal thinks that the remaining issues have been addressed that would block implementation here. Anba, does that sound right to you? Is there any feedback you'd like me to share with TG2?
Assignee | ||
Comment 12•2 years ago
|
||
I can look into it. DurationFormat requires NumberFormat v3, which is currently only available in Nightly. I've prepared some patches to enable it by default, but realised too late that you're already assigned to bug 1795756. I hope you don't mind me stealing that bug.
Assignee | ||
Comment 13•2 years ago
|
||
(In reply to Dan Minor [:dminor] from comment #11)
Ujjwal thinks that the remaining issues have been addressed that would block implementation here. Anba, does that sound right to you? Is there any feedback you'd like me to share with TG2?
I've filed the following issues on the proposal bug tracker:
- Editorial: https://github.com/tc39/proposal-intl-duration-format/issues/151
- Editorial: https://github.com/tc39/proposal-intl-duration-format/issues/152
- Editorial: https://github.com/tc39/proposal-intl-duration-format/issues/154
- Normative: https://github.com/tc39/proposal-intl-duration-format/issues/155
- Normative: https://github.com/tc39/proposal-intl-duration-format/issues/156
- Normative: https://github.com/tc39/proposal-intl-duration-format/issues/157
In addition to that, there are the following open PRs:
- Normative: https://github.com/tc39/proposal-intl-duration-format/pull/150
- I've found two issues with the current PR.
- Editorial: https://github.com/tc39/proposal-intl-duration-format/pull/134 and https://github.com/tc39/proposal-intl-duration-format/pull/143
- The PartitionDurationFormatPattern abstract operation isn't quite correct, the two PRs aim to fix it in different ways. For example when strictly following the current PartitionDurationFormatPattern definition, formatting
{hours:12, minutes:30, seconds:45}
with the"digital"
style returns the string"12, :, 30, :, & 45"
instead of"12:30:45"
. So we have to guess/interpret how the abstract operation should have been defined. This isn't strictly a blocker for implementations, but definitely a blocker for stage 4.
- The PartitionDurationFormatPattern abstract operation isn't quite correct, the two PRs aim to fix it in different ways. For example when strictly following the current PartitionDurationFormatPattern definition, formatting
Updated•2 years ago
|
Comment 14•1 year ago
|
||
Hi Anba, it looks like the issues and PRs above have been addressed (or at least closed...) This is on the agenda for the TC39 plenary next week, do you have any concerns about the proposal as it currently stands?
Assignee | ||
Comment 15•1 year ago
|
||
I haven't kept track of the proposal. There were multiple larger refactorings since January, so I don't really know the current state of the proposal. It's possible that new bugs crept in as part of these changes, which may require more follow-up fixes. Hopefully this will all be editorial, but it's possible that more normative changes will be necessary.
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Comment 16•10 months ago
|
||
Comment 17•10 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/123880a450b9
https://hg.mozilla.org/mozilla-central/rev/05549eed8b9d
https://hg.mozilla.org/mozilla-central/rev/702c752df5a2
https://hg.mozilla.org/mozilla-central/rev/adf12e0fd8d1
https://hg.mozilla.org/mozilla-central/rev/bdb228dd5915
https://hg.mozilla.org/mozilla-central/rev/8d36bf883a70
https://hg.mozilla.org/mozilla-central/rev/96fcefa9a41a
Comment 18•10 months ago
•
|
||
FF134 MDN docs work for this can be tracked in https://github.com/mdn/content/issues/36917
- Is this also shipped? I can't see evidence of a preference, but that isn't always obvious is JS issues.
- As far as you know, is it fully spec compliant and complete? This is documented on MDN, but I will check that matches the spec - want to also check that it matches what FF did.
Assignee | ||
Comment 19•10 months ago
|
||
(In reply to Hamish Willee from comment #18)
- Is this also shipped? I can't see evidence of a preference, but that isn't always obvious is JS issues.
It's currently restricted to Nightly builds.
- As far as you know, is it fully spec compliant and complete? This is documented on MDN, but I will check that matches the spec - want to also check that it matches what FF did.
Yes, the implementation is fully spec compliant and complete.
Updated•10 months ago
|
Updated•10 months ago
|
Updated•9 months ago
|
Description
•