Files
tubestation/config
André Bargull 51f3a158d7 Bug 1899177 - Part 5: Support simple calendar methods calling into ICU4X. r=spidermonkey-reviewers,dminor
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>.

Differential Revision: https://phabricator.services.mozilla.com/D211766
2024-06-20 17:42:15 +00:00
..