Closed Bug 1954138 Opened 4 months ago Closed 3 months ago

Add ICU4X-based icu::Calendar implementations

Categories

(Core :: JavaScript: Internationalization API, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(9 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
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

Some Temporal calendars are currently Nightly-only due to differences between ICU4C and ICU4X, see bug 1950425. Adding custom icu::Calendar implementations which delegate to ICU4X will allow to re-enable these calendars again. (Except for islamic-umalqura which requires changes in ICU4X, cf. https://github.com/unicode-org/icu4x/issues/4982.)

Patch ICU to allow modifying DateIntervalFormat's calendar.

Used in parts 2 and 4.

Always reset the Gregorian change date, because all uses either require the
Gregorian change date to be set to -8.64e15 or don't care about dates far
into the past.

The slow DateIntervalFormat::TryFormatCalendar is now only used when
MOZ_SYSTEM_ICU is defined.

And also resets the Gregorian change date for "buddhist", "japanese", and
"roc" to get consistent results when compared to the ICU4X-based Temporal
code.

Add ICU4X based calendars for Chinese, Dangun, Hijri observational, and
Persian to ensure consistent behaviour across Intl.DateTimeFormat and
Temporal.

This requires using the ICU4C C++ API, so it's not possible to use when
MOZ_SYSTEM_ICU is defined. And ICU4X's calendar FFI needs to be available,
which is currently guarded by JS_HAS_TEMPORAL_API.

Apply the calendar overrides from part 3.

ICU4X can return zero for day-of-month for Hijri calendars. Add a workaround
and more assertions to catch other possible invalid values from ICU4X.

There are still differences for some calendars:

Negative years in the Hebrew calendar shouldn't be too important, if necessary we
could also provide our own icu::Calendar implementation to use ICU4X. And for
Umm-Al-Qura we should wait for ICU4X to align with KACST.

Re-enable all calendars except IslamicUmmAlQura, which should be first changed
in ICU4X to agree with KACST.

Upstream issue: https://github.com/unicode-org/icu4x/issues/6197

Blocks: sm-icu
Severity: -- → N/A
Priority: -- → P2
Attachment #9472123 - Attachment description: Bug 1954138 - Part 3: Add ICU4X-based calendars. r=dminor! → Bug 1954138 - Part 3: Add ICU4X-based Chinese and Dangun calendars. r=dminor!
Attachment #9472130 - Attachment description: Bug 1954138 - Part 9: Re-enable most calendars even when not Nightly. r=dminor! → Bug 1954138 - Part 9: Re-enable Chinese and Dangi calendars even when not Nightly. r=dminor!
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b9b87d145273 Part 1: Add DateIntervalFormat::adoptCalendar. r=dminor https://hg.mozilla.org/integration/autoland/rev/b21bf0c9df17 Part 2: Set Gregorian change date when constructing formatters. r=dminor https://hg.mozilla.org/integration/autoland/rev/35ee60498333 Part 3: Add ICU4X-based Chinese and Dangun calendars. r=dminor,sylvestre https://hg.mozilla.org/integration/autoland/rev/cf966cb71ae7 Part 4: Apply overrides for calendars. r=dminor https://hg.mozilla.org/integration/autoland/rev/a71d9190e4f3 Part 5: Add workaround for zero day-of-month. r=dminor https://hg.mozilla.org/integration/autoland/rev/53f9d4a8dfe1 Part 6: Add a patch for ICU-23069. r=dminor https://hg.mozilla.org/integration/autoland/rev/9ca91f37f2a5 Part 7: Test case to ensure Temporal and Intl.DateTimeFormat are consistent. r=dminor https://hg.mozilla.org/integration/autoland/rev/77c43d75ef9f Part 8: Add a comment about a difference when compared to the spec polyfill. r=dminor https://hg.mozilla.org/integration/autoland/rev/812169f4258e Part 9: Re-enable Chinese and Dangi calendars even when not Nightly. r=dminor

Backed out for causing process crash @RaiseException

Flags: needinfo?(andrebargull)
Flags: needinfo?(andrebargull)
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/9ebef6fdde0b Part 1: Add DateIntervalFormat::adoptCalendar. r=dminor https://hg.mozilla.org/integration/autoland/rev/d9e574de3c9d Part 2: Set Gregorian change date when constructing formatters. r=dminor https://hg.mozilla.org/integration/autoland/rev/c7e09e2ace9d Part 3: Add ICU4X-based Chinese and Dangun calendars. r=dminor,sylvestre https://hg.mozilla.org/integration/autoland/rev/8859922bd545 Part 4: Apply overrides for calendars. r=dminor https://hg.mozilla.org/integration/autoland/rev/c826e881a621 Part 5: Add workaround for zero day-of-month. r=dminor https://hg.mozilla.org/integration/autoland/rev/e945a234d4f7 Part 6: Add a patch for ICU-23069. r=dminor https://hg.mozilla.org/integration/autoland/rev/ccd126599ad3 Part 7: Test case to ensure Temporal and Intl.DateTimeFormat are consistent. r=dminor https://hg.mozilla.org/integration/autoland/rev/98e3f72d0afc Part 8: Add a comment about a difference when compared to the spec polyfill. r=dminor https://hg.mozilla.org/integration/autoland/rev/0d38ed4696e1 Part 9: Re-enable Chinese and Dangi calendars even when not Nightly. r=dminor
QA Whiteboard: [qa-triage-done-c140/b139]
Regressions: 1972781
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: