Support more built-in calendars in Temporal
Categories
(Core :: JavaScript: Standard Library, enhancement, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox129 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(18 files)
|
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 | |
|
Bug 1899177 - Part 5: Support simple calendar methods calling into ICU4X. r=#spidermonkey-reviewers!
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 | |
|
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 |
Support more built-in calendars in Temporal than just the ISO-8601 calendar.
| Assignee | ||
Comment 1•2 years ago
|
||
Enable the "icu_calendar" feature from ICU4X for use in Temporal.
| Assignee | ||
Comment 2•2 years ago
|
||
The large files check in "vendor_rust.py" had to be manually disabled to allow
importing "third_party/rust/calendrical_calculations/src/astronomy.rs". (About 20% of
the file size is test code.)
Depends on D211762
| Assignee | ||
Comment 3•2 years ago
|
||
All calendars supported by ICU4X require a strictly positive era-year. We can
easily enforce this by restricting the eraYear temporal field to be positive.
Depends on D211763
| Assignee | ||
Comment 4•2 years ago
|
||
Allow other calendar identifiers than just "iso8601". Also make sure old deprecated
aliases are properly updated to their preferred form.
Depends on D211764
| Assignee | ||
Comment 5•2 years ago
|
||
Implement the following operations:
- CalendarDateMonth
- CalendarDateDay
- CalendarDateDayOfWeek
- CalendarDateWeekOfYear
- CalendarDateDaysInWeek
- CalendarDateDaysInMonth
- CalendarDateDaysInYear
- CalendarDateMonthsInYear
Calendar arithmetic isn't currently supported in ICU4X through the public
API, so for now we simply default to the ISO calendar operations for:
- CalendarDateAddition
- CalendarDateDifference
Calendrical computations are performed through ICU4X instead of ICU4C, as
previously discussed on multiple occasions.
The Temporal spec leaves the concrete semantics of any calendar except the
ISO-8601 calendar as implementation-defined, so we're free to implement things
however we like. For better cross-engine compatibility, certain aspects should
probably clarified, though. For example in the Japanese calendar with its
regnal eras, if the user-supplied eraYear exceeds the named era, do we
constrain eraYear to the end of the era or do we alternatively switch to the
next era? Bug reports against the Temporal spec repo will be written to clarify
these points.
This patch doesn't perform any caching, so the ICU4X calendar and date types are
created from scratch for all operations. This will likely be too slow (10-100x
slow-downs when compared to using the non-ICU4X based ISO-8601 calendar), so in
a follow-up bug we likely need to investigate how to add some sort of caching.
And just as with Intl.Segmenter, we're using the ICU4X C-API instead of the
C++ API, see also https://github.com/rust-diplomat/diplomat/issues/280.
Depends on D211765
| Assignee | ||
Comment 6•2 years ago
|
||
Add code to convert between Temporal and ICU4X era codes. And then implement
more calendar operations which are possible when era codes are supported.
Depends on D211766
| Assignee | ||
Comment 7•2 years ago
|
||
Implement code to handle month codes and to determine which month codes are
available for the different built-in calendar types.
Depends on D211767
| Assignee | ||
Comment 8•2 years ago
|
||
Depends on D211768
| Assignee | ||
Comment 9•2 years ago
|
||
Add code to convert calendar dates to ISO calendar dates, including overflow behaviour
to constrain resp. reject too large values.
The complicated CreateDateFrom and CreateDateFromCodes functions are also used in
the next part.
Depends on D211769
| Assignee | ||
Comment 10•2 years ago
|
||
Implement the operations to interpret user-supplied temporal fields as calendar dates.
Depends on D211770
| Assignee | ||
Comment 11•2 years ago
|
||
Similar to part 10, this operation interprets user inputs as month-day information
and then resolves the matching ISO date.
Depends on D211771
| Assignee | ||
Comment 12•2 years ago
|
||
Depends on D211772
| Assignee | ||
Comment 13•2 years ago
|
||
Add tests for issues encountered during development of the
built-in calendar feature.
Depends on D211774
| Assignee | ||
Comment 14•2 years ago
|
||
We could require ICU4X for Temporal, which will allow us to remove some
#if defined(MOZ_ICU4X) guards. See the next part.
Depends on D211775
| Assignee | ||
Comment 15•2 years ago
|
||
Remove guards which aren't required anymore when ICU4X is strictly required for
Temporal.
Depends on D211776
| Assignee | ||
Comment 16•2 years ago
|
||
Depends on D211777
Updated•2 years ago
|
| Assignee | ||
Comment 17•1 year ago
|
||
Depends on D211762
| Assignee | ||
Comment 18•1 year ago
|
||
Depends on D211763
Comment 19•1 year ago
|
||
Comment 20•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0bf2e1a23a9c
https://hg.mozilla.org/mozilla-central/rev/a30375873882
https://hg.mozilla.org/mozilla-central/rev/afa030ec8eb0
https://hg.mozilla.org/mozilla-central/rev/854faa667cab
https://hg.mozilla.org/mozilla-central/rev/d3a840a90933
https://hg.mozilla.org/mozilla-central/rev/5eb22ccbff43
https://hg.mozilla.org/mozilla-central/rev/a20785863ddd
https://hg.mozilla.org/mozilla-central/rev/00cc2684b43d
https://hg.mozilla.org/mozilla-central/rev/b1a56399314f
https://hg.mozilla.org/mozilla-central/rev/c399d8e8970f
https://hg.mozilla.org/mozilla-central/rev/91b1c940f830
https://hg.mozilla.org/mozilla-central/rev/3f13fe57609a
https://hg.mozilla.org/mozilla-central/rev/0e96407ac3cc
https://hg.mozilla.org/mozilla-central/rev/126c31ada138
https://hg.mozilla.org/mozilla-central/rev/b63bd051f362
https://hg.mozilla.org/mozilla-central/rev/0e73fddfdb51
https://hg.mozilla.org/mozilla-central/rev/7d7cd36bc5c3
https://hg.mozilla.org/mozilla-central/rev/1af5bef2fcd2
Description
•