Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 171864159318a3d0c4c344f0775ab26210e841b9
https://github.com/WebKit/WebKit/commit/171864159318a3d0c4c344f0775ab26210e841b9
Author: Yijia Huang <[email protected]>
Date: 2026-08-14 (Fri, 14 Aug 2026)
Changed paths:
M JSTests/stress/intl-datetimeformat.js
M Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
Log Message:
-----------
[JSC][Intl] Compute the "Before Hijra" year from the calendar, not ICU's
rendered text
https://bugs.webkit.org/show_bug.cgi?id=321713
rdar://184853584
Reviewed by Sosuke Suzuki.
Islamic calendars have only one ICU era value, so pre-Hijra dates come back as
a negative raw
year under it instead of a distinct era. The existing workaround detects the
epoch boundary and substitutes "Before Hijra" text, but left the year
untouched, so a pre-Hijra
date rendered as e.g. "-332 Before Hijra" — double-negative, and inconsistent
with how Gregorian's
native "Before Christ" and Temporal's own eraYear for this exact era both read
(1 - year, no year
zero: "333 Before Hijra").
Fixes the year to match that convention. The value comes from a clone of the
format's own calendar
(cloned and given its own millis, same pattern already used by
createCalendarForDate in this file)
rather than by parsing ICU's already-rendered year text — parsing would be
wrong under
year:"2-digit", since ICU truncates to two digits before this code ever sees
the string, and
flipping an already-truncated number does not equal truncating the
correctly-flipped one.
EraOverride now carries a needsYearFlip flag (true for
islamic-civil/tbla/umalqura, false for
coptic — ICU already renders coptic's year correctly on its own) instead of a
bare era string, and
the flip is computed once in a shared helper used by both format() and
formatToParts(), which
previously would have needed the identical logic written out twice.
Test: JSTests/stress/intl-datetimeformat.js
Canonical link: https://commits.webkit.org/319172@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications