Disable islamic, chinese and dangi calendars in Temporal
Categories
(Core :: JavaScript: Standard Library, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox138 | --- | fixed |
People
(Reporter: dminor, Assigned: dminor)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Temporal is using ICU4X for calendrical calculations, while the rest of the Internationalization code is using ICU4C. This can lead to inconsistent results inside of Firefox, depending upon whether ICU4C or ICU4X APIs are used (for example, see the code at the bottom of https://bugzilla.mozilla.org/show_bug.cgi?id=1912511#c5). In particular, the islamic, chinese and dangi calendars are affected by this.
I think we should not ship support for these calendars while we work with ICU4X, ICU4C and CLDR to resolve these differences, or until we've migrated to using ICU4X for date time formatting (as part of https://bugzilla.mozilla.org/show_bug.cgi?id=1824678) so that we're generating consistent results in both Intl code and Temporal.
Updated•5 months ago
|
Comment 1•5 months ago
|
||
islamic-umalqura
is also affected. See https://github.com/unicode-org/icu4x/issues/4982#issuecomment-2684297930 .
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Comment 2•5 months ago
|
||
My plan is to leave these enabled on Nightly, but disable them for beta and release, so we can continue to have test coverage on Nightly. Since we're currently only shipping for Nightly, this will be a no-op for now, but I think it's worth having in place prior to trying to ship. I'll plan to land this for Firefox 138.
Comment 3•5 months ago
|
||
islamic-rgsa
is unimplementable into the future, and neither ICU4C nor ICU4X implement it into the past, either. See https://searchfox.org/mozilla-central/rev/2f561d04a5344910a9b06410ebcef668f7e3508f/intl/icu/source/i18n/islamcal.h#650-654 . Given that neither ICU4C nor ICU4X has an implementation matching the definition, I think we should disable islamic-rgsa
in Temporal and even consider unshipping it on the DateTimeFormat
side.
AFAICT, the situation is:
chinese
anddangi
: ICU4C needs to be fixed.islamic-umalqura
: ICU4X needs to be fixed.islamic-rgsa
: Neither ICU4X nor ICU4C has an implementation, but ICU4C delegates to itsislamic
implementation.islamic
: The reference location on Earth isn't well defined. ICU4X uses Cairo, which is the sample location from Reingold's code. ICU4C does not make it clear what reference location it uses.
(As I understand it, islamic-civil
and islamic-tbla
are well-defined and interoperable.)
Comment 4•5 months ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #3)
chinese
anddangi
: ICU4C needs to be fixed.
I'm currently prototyping a workaround to write a icu::Calendar
subclass which delegates to ICU4X. It seems to work for simple cases, but still needs more testing. (This uses the ICU4C C++ API, so it won't be applicable for MOZ_SYSTEM_ICU
.)
islamic-umalqura
: ICU4X needs to be fixed.
There are apparently different ICU4X issues affecting islamic-umalqura
:
- In some cases the compiled-data doesn't agree with the always calculating results. Note: The always calculating calendar versions aren't available through FFI.
- Incompatibilities with KACST approximations. ICU4C uses a hard-coded table for Hijri years 1300-1600 with data supplied by KACST. Outside that range ICU4C falls back to
islamic-civil
.
islamic
: The reference location on Earth isn't well defined. ICU4X uses Cairo, which is the sample location from Reingold's code. ICU4C does not make it clear what reference location it uses.
The same workaround for Chinese/Dangun calendar might work here, too.
(As I understand it,
islamic-civil
andislamic-tbla
are well-defined and interoperable.)
Yes, these two calendar variants are interoperable.
Assignee | ||
Comment 5•5 months ago
|
||
An icu::Calendar
subclass that delegates to ICU4X would be a very elegant fix, I had a quick look, and wasn't sure how much work would be involved, but I'm happy to hear you've got something initial working already.
Assignee | ||
Comment 6•5 months ago
|
||
Comment 8•4 months ago
|
||
bugherder |
Description
•