Closed Bug 1950425 Opened 5 months ago Closed 4 months ago

Disable islamic, chinese and dangi calendars in Temporal

Categories

(Core :: JavaScript: Standard Library, task, P3)

task

Tracking

()

RESOLVED FIXED
138 Branch
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.

Severity: -- → N/A
Priority: -- → P3
Assignee: nobody → dminor
See Also: → icu4x

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.

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 and dangi: 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 its islamic 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.)

(In reply to Henri Sivonen (:hsivonen) from comment #3)

  • chinese and dangi: 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 and islamic-tbla are well-defined and interoperable.)

Yes, these two calendar variants are interoperable.

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.

Depends on: 1951411
No longer depends on: 1951411
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e1b469b6426c Disable islamic, chinese and dangi calendars in temporal; r=anba
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: