Implement dateStyle and timeStyle option on Intl.DateTimeFormat
Categories
(Core :: JavaScript: Internationalization API, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox79 | --- | fixed |
People
(Reporter: alex.fdm, Assigned: anba)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-complete, parity-chrome)
Attachments
(5 files)
The specification is already on Stage 3: https://github.com/tc39/proposal-intl-datetime-style
There was a previous implementation of these on bug #1329904, but it does not seem to follow the current spec.
Updated•5 years ago
|
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Btw. this is already implemented in SpiderMonkey for internal use (bug 1329904) - in fact the ECMA402 proposal has been kicked off by us to expose that.
So this should mostly be about exposing already existing bits to public.
Assignee | ||
Comment 2•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 3•4 years ago
|
||
mozExtensions
is now only used for the patternOption
property, because
dateStyle
and timeStyle
are no longer custom extensions. So instead of
testing for mozExtensions
, we can simply only test if patternOptions
is
present.
And update Intl_DateTimeFormat_resolvedOptions
to only set the "hour12"
and "hourCycle" options when timeStyle
is used.
Depends on D73892
Assignee | ||
Comment 4•4 years ago
|
||
Depends on D73894
Assignee | ||
Comment 5•4 years ago
|
||
CLDR provides date-time patterns, not skeletons, for date/time-styles, so
when either hour12
or hourCycle
is present, we need to adjust the returned
pattern to use the correct hour symbol.
Drive-by change:
- Move
replaceHourRepresentation
for standard options to C++. - Change
resolveDateTimeFormatInternals
to no longer change the hour
symbol when the non-standardpatternOption
is used.
Depends on D73895
Assignee | ||
Comment 6•4 years ago
|
||
Depends on D73896
Pushed by cbrindusan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fcbfbb53396d Part 1: Reduce code duplication for date/time-style parsing. r=jwalden https://hg.mozilla.org/integration/autoland/rev/12fe4bb1d720 Part 2: Remove "mozExtensions" flag from resolved internal options. r=jwalden https://hg.mozilla.org/integration/autoland/rev/97ab994e8e06 Part 3: Implement date-/timeStyle proposal. r=jwalden https://hg.mozilla.org/integration/autoland/rev/8118b2bfb39d Part 4: Add hourCycle support to date/time-style. r=jwalden https://hg.mozilla.org/integration/autoland/rev/b9853d5eb007 Part 5: Enable test262 tests for date-/timeStyle. r=jwalden
Comment 8•4 years ago
|
||
Backed out 5 changesets for causing bustages in DateTimeFormat.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/dab3c58da8d2202fbacdf818e53503e1ac9d5a68
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=305830727&repo=autoland&lineNumber=17103
Assignee | ||
Updated•4 years ago
|
Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/728f07ec3003 Part 1: Reduce code duplication for date/time-style parsing. r=jwalden https://hg.mozilla.org/integration/autoland/rev/4a973d7cbca2 Part 2: Remove "mozExtensions" flag from resolved internal options. r=jwalden https://hg.mozilla.org/integration/autoland/rev/dd064bac3143 Part 3: Implement date-/timeStyle proposal. r=jwalden https://hg.mozilla.org/integration/autoland/rev/f0a7e9cdc27c Part 4: Add hourCycle support to date/time-style. r=jwalden https://hg.mozilla.org/integration/autoland/rev/ecc73e9b85b1 Part 5: Enable test262 tests for date-/timeStyle. r=jwalden
Comment 10•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/728f07ec3003
https://hg.mozilla.org/mozilla-central/rev/4a973d7cbca2
https://hg.mozilla.org/mozilla-central/rev/dd064bac3143
https://hg.mozilla.org/mozilla-central/rev/f0a7e9cdc27c
https://hg.mozilla.org/mozilla-central/rev/ecc73e9b85b1
Comment 11•4 years ago
|
||
Release notes announcement:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/79#JavaScript
Reference docs now mention the new constructor options:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
Compat data:
https://github.com/mdn/browser-compat-data/pull/6358
Let me know if you have any feedback.
Assignee | ||
Comment 12•4 years ago
|
||
(In reply to Florian Scholz [:fscholz] (MDN) from comment #11)
Let me know if you have any feedback.
LGTM. Thanks!
Description
•