Skip to content

[JSC][Temporal] Hijri and Persian years below 1: report the real year and month lengths - #598

Open
robobun wants to merge 1 commit into
mainfrom
robobun/67280f13/temporal-tabular-calendars-before-epoch
Open

robobun wants to merge 1 commit into
mainfrom
robobun/67280f13/temporal-tabular-calendars-before-epoch

Conversation

@robobun

@robobun robobun commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • For islamic-civil, islamic-tbla, islamic-umalqura and persian, Temporal reports most years below 1 as leap when they are not: inLeapYear is true, daysInYear is 355 or 366, month 12 has 30 days, while until() to the next new year measures 354 or 365 days. So {year: -7, month: 12, day: 30} passes overflow: "reject" and is the same ISO day as {year: -6, month: 1, day: 1}, -4-12-30 + P1Y gives -2-01-30 instead of -3-12-29 in the Hijri calendars, and persian -1-11-30 + P1M throws a RangeError. Years from 1 on are fine, and every date still maps to the right ISO day.
  • The cause is ICU4C 78, not the bridge. IslamicCivilCalendar::civilLeapYear() is (14 + 11 * year) % 30 < 11 (always was) and PersianCalendar::isLeapYear() is (25 * year + 11) % 33 < 8 (since ICU 75: ICU-22633, unicode-org/icu@d43d216feb replaced a ClockMath::floorDivide), with C++'s truncating %. A negative dividend (Hijri year <= -2, Persian year <= -1) gives a remainder <= 0, so every such year reads as leap in handleGetYearLength() / handleGetMonthLength(). yearStart() / monthStart() floor-divide and stay correct. islamic-umalqura uses the civil rule outside its 1300-1600 AH table. ucal_add(UCAL_MONTH / UCAL_EXTENDED_YEAR) pins DAY_OF_MONTH against the same wrong length, which is where the month-off arithmetic comes from.

Fix

  • CalendarICUBridge.cpp gets a small tabular layer (tabularLeapYear, tabularDaysInYear, tabularDaysInMonth, read through tabularYearBelowOneAtCursor / daysInMonthAtCursor). For a Hijri or Persian cursor in a year below 1 it answers from the leap rules with a floored remainder, as icu4x does (TabularAlgorithm::year in cal/hijri.rs, is_leap_year in calendrical_calculations/src/persian.rs). Every other read still goes to ucal_getLimit. calendarDaysInMonth, calendarDaysInYear, calendarInLeapYear, nonISOCalendarDateToISO, setMonths and the date-add day regulation use it.
  • The three Hijri calendars have twelve months every year, so they move to the direct-construction arithmetic path that coptic, ethiopic, ethioaa, indian and persian already use (balance year and month, set the native fields, regulate the day). ucal_add() is now used by the lunisolar calendars only, with an ASSERT. The fixedSolar* helpers are renamed fixedMonth* (calendarIsNonISOSolar becomes calendarHasFixedMonths) because the set is no longer solar. Month differences in the Hijri calendars also stop walking one month at a time.
  • Correct because the lengths now come from the same floored rule that ICU's own monthStart() uses to place the days, so daysInYear equals the distance between new years and the month lengths add up to it, for every year. Positive years and all other calendars take the same code as before (the tabular layer returns nullopt, the Hijri arithmetic constructs the same fields ucal_add produced).
  • Verified: JSTests/stress/temporal-tabular-calendars-before-epoch.js (new, fails on 2e2aa2290f at its first assertion, passes here). All 117 JSTests/stress/temporal-* / intl-datetimeformat-temporal-* files and the 6632 test262 files under built-ins/Temporal and intl402/Temporal give the same results as the 2e2aa2290f jsc. Details and the icu4x comparison are in the notes.

Background

  • CalendarICUBridge.cpp implements Temporal's non-ISO calendar operations on top of ICU4C's UCalendar (ucal_set / ucal_getMillis to place a date, ucal_getLimit(..., UCAL_ACTUAL_MAXIMUM) for month and year lengths, ucal_add for lunisolar arithmetic). Its comments cite the icu4x and temporal_rs code that V8 and the spec tests follow, and it already carries ICU4C-WORKAROUND blocks where ICU4C disagrees (Hebrew year 0, Indian extreme years).
  • The tabular Hijri calendar has 30/29-day months alternating and adds a day to Dhu al-Hijjah in 11 years of each 30-year cycle; islamic-civil and islamic-tbla differ only in epoch (Friday vs Thursday), and islamic-umalqura is a table for 1300-1600 AH with the civil rule outside it. The arithmetic Persian calendar has six 31-day months, five 30-day months and a 29/30-day Esfand, leap in 8 years of each 33-year cycle (plus a correction table from 1502 AP on, not relevant below year 1).
  • "Extended year" is ICU's signed proleptic year (UCAL_EXTENDED_YEAR); Temporal's year for these calendars is that value, with eras ah/bh and ap derived from it.
Notes
  • icu4x comparison: a Rust probe on icu_calendar 2.3.0 (Hijri::new_tabular(TypeII, Friday|Thursday), Hijri::new_umm_al_qura(), Persian) printed inLeapYear, daysInYear, month-12 length and the ISO date of 1/1 for every year from -1500 to 1700 in the four calendars (12804 rows). This build matches all of them; 2e2aa2290f differs in 3987 rows. A second probe ran 16000 random cases per configuration (date construction with constrain, add with years/months/days under constrain and reject, until with largestUnit years and months, daysInMonth, daysInYear, inLeapYear, dayOfYear) through try_added_with_options / try_until_with_options and through this jsc, for year ranges [-400, 1700], [-2000, -1], [1, 1700] and [1290, 1610] with several seeds: 0 differences. The 2e2aa2290f jsc differs in most negative-year rows and throws RangeError: Duration is outside the representable range from until() on some of them.
  • islamic-umalqura inside its table keeps ICU's data: the new stress test pins 1442 (civil-leap, 29-day Dhu al-Hijjah in the table) and 1444 (civil-common, 30-day Dhu al-Hijjah and Safar), including add and until through the new arithmetic path.
  • temporal-now-overridden-date-now.js fails the same way on both shells here (other.$vm is undefined on a $vm.createGlobalObject() global in this configuration); unrelated.
  • Hebrew years <= 0 have a related but separate ICU4C problem (HebrewCalendar::startOfYear() truncates frac / DAY_PARTS and day % 7 for negative day numbers, so new years before 1 AM land a day off icu4x and the dehiyyot misfire). The existing rdar://182958553 year-0 Kislev workaround covers one symptom of it. This PR does not touch Hebrew.
  • The branch is on 2e2aa2290f, the commit Bun pins, so the preview build is that commit plus this change. Bun side: Temporal: Hijri and Persian years below 1 report the real year and month lengths (WebKit bump) bun#42087.
  • A second verification pass over positive-year Hijri arithmetic (about 100k add/subtract/until/since/PlainYearMonth/Duration rows for years 1..5000, the whole umalqura table, both PlainDate limits, add(until()) round trips for years -50..50) found no difference from 2e2aa2290f except results landing in years below 1 and one spec-mandated case: a Hijri PlainYearMonth.add whose result month starts past +275760-09-13 now throws RangeError (CalendarDateAdd's ISODateWithinLimits step), as persian already did.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 006d0648-818a-4536-b460-4dc740371321

📥 Commits

Reviewing files that changed from the base of the PR and between dfd6964 and 0837a0e.

📒 Files selected for processing (2)
  • JSTests/stress/temporal-tabular-calendars-before-epoch.js
  • Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp

Included review availability: Your plan provides up to 5 included reviews per hour; 0 remain after this review.


Walkthrough

Changes

The Temporal implementation now calculates negative-year Islamic and Persian tabular calendar fields correctly. Fixed-month arithmetic uses these lengths for date construction, addition, balancing, and until calculations. Stress tests cover negative years, conversions, regressions, and Umm al-Qura data.

Tabular calendar support

Layer / File(s) Summary
Tabular field rules
Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp
Tabular Islamic and Persian calendars now use corrected leap-year, year-length, and month-length calculations below year 1.
Fixed-month arithmetic
Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp
Date addition, month balancing, month differences, date-until calculations, and month regulation now use calendar-aware lengths for fixed-month calendars.
Negative-year regression tests
JSTests/stress/temporal-tabular-calendars-before-epoch.js
Stress tests validate calendar fields, arithmetic, ISO conversion, positive-year behavior, and Umm al-Qura table behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 0837a

This change corrects negative-year Islamic and Persian calendar calculations while preserving positive-year and Umm al-Qura table behavior. The covered arithmetic and conversion paths show no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the JSC Temporal change and the affected Hijri and Persian years below 1. It accurately summarizes the corrected year and month lengths.
Description check ✅ Passed The description is detailed and directly explains the problem, cause, fix, affected calendars, implementation changes, and verification results. It does not follow the repository template exactly beca…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. It's a carefully constructed workaround, but because it moves the three tabular Hijri calendars onto a different arithmetic path for all years (not just negative ones) and both changed paths fall under jsc-reviewers in CODEOWNERS, a human look would still be worthwhile.

What was reviewed:

  • tabularLeapYear matches the cited icu4x formulas (Persian 25y+11 mod 33 < 8, Hijri 11y+14 mod 30 < 11) with a floored remainder, and widens to int64_t before multiplying so extreme extended years don't overflow.
  • calendarIsIslamic covers only islamic-civil/tbla/umalqura, so with calendarHasFixedMonths now including it, the new ASSERT(calendarIsLunisolar(...)) on the ucal_add fallthrough holds for the supported calendar set (chinese/dangi/hebrew are the only non-Gregorian, non-fixed-month calendars left).
  • tabularYearBelowOneAtCursor returns nullopt for non-tabular calendars and for year ≥ 1, so daysInMonthAtCursor and the days/leap-year callers still fall through to ucal_getLimit for positive years (including umalqura's 1300-1600 AH table) and for every other calendar.
  • The new stress test follows JSTests/README.md rules: //@ requireOptions, assertions throw, no logging; it isn't iteration-count-driven so testLoopCount doesn't apply.
Extended reasoning...

Overview

The PR touches two files: Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp (~150 lines net) and a new 171-line stress test JSTests/stress/temporal-tabular-calendars-before-epoch.js. The C++ change adds a small tabular-calendar layer (tabularLeapYear, tabularDaysInYear, tabularDaysInMonth, tabularYearBelowOneAtCursor, daysInMonthAtCursor) that overrides ICU4C's month/year lengths for Hijri and Persian years below 1, where ICU's truncating % misclassifies almost every year as leap. It wires this into calendarDaysInMonth, calendarDaysInYear, calendarInLeapYear, nonISOCalendarDateToISO, setMonths, and the day-regulation step of fixedMonthDateAdd. Independently, it renames the fixedSolar* helpers to fixedMonth* and adds calendarIsIslamic() to calendarHasFixedMonths, so the three tabular Hijri calendars now take the direct native-field-construction arithmetic path in calendarDateAdd / nonISODateUntil for every year, with ASSERT(calendarIsLunisolar(...)) guarding the remaining ucal_add branches.

Security risks

None identified. This is pure calendar arithmetic on integers and ICU handles; there is no parsing of untrusted input beyond what the existing Temporal entry points already validate, no auth/crypto/permissions surface, and no memory management changes. The one overflow-shaped concern — 11 * extendedYear / 25 * extendedYear on an int32_t year — is handled by the explicit static_cast<int64_t> before the multiply.

Level of scrutiny

This warrants a human reviewer. The change is not mechanical: it substitutes hand-computed month/year lengths for ICU's in a specific year range and simultaneously moves three calendars onto a different arithmetic implementation for all years. The PR description says positive-year Hijri arithmetic now constructs the same fields ucal_add produced, and the stress test pins a handful of positive-year and umalqura-table cases, but the equivalence claim across the whole positive range (and the 12804-row / 16000-random-case icu4x comparison) is stated, not something I can independently reproduce here. Both changed paths are listed under @ WebKit/jsc-reviewers in .github/CODEOWNERS, and the file already carries ICU4C-WORKAROUND blocks that were presumably reviewed with similar care.

Other factors

The change follows the file's established patterns closely (TemporalResult<> error propagation, [[unlikely]] on error branches, ICU4C-WORKAROUND comment blocks with icu4x citations), and the new test conforms to the JSTests/README.md rules (throw-on-failure assertions, no printing, //@ requireOptions("--useTemporal=1")). The PR reports that all existing temporal-* stress tests and 6632 test262 Temporal files give identical results before and after, which — if it holds on CI — is the strongest evidence that the positive-year path move is behavior-preserving. The bug hunt ran to a dry streak with no findings and no ruled-out candidates.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Preview build of d31f1c5: autobuild-preview-pr-598-d31f1c5a

@robobun

robobun commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Bun-side PR with the WEBKIT_VERSION bump to the preview build and the test/js/web/temporal/temporal.test.ts coverage: oven-sh/bun#42087 (16/16 pass against autobuild-preview-pr-598-092e8258, 8 of them fail on bun 1.4.3).

@robobun
robobun force-pushed the robobun/67280f13/temporal-tabular-calendars-before-epoch branch from 092e825 to 0c7a17d Compare September 9, 2026 06:31
@robobun

robobun commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 0c7a17d: comment and commit message now cite where the ICU behaviour comes from (Persian: ICU-22633, unicode-org/icu@d43d216feb in ICU 75 replaced a ClockMath::floorDivide with %; Hijri: civilLeapYear() always used %). No code change from 092e825. There is no ICU ticket or bugs.webkit.org bug for the negative-year case yet that I could find; upstream CalendarICUBridge.cpp is byte-identical, so the same commit applies to WebKit/WebKit as is if someone wants to send it there.

Self-reviewed: the review agreed the change should exist in this file and shape; its asks were the tracker citation above and sequencing with #606. A second pass over positive-year Hijri arithmetic (about 100k add/subtract/until/since/PlainYearMonth/Duration.round rows, years 1..5000 including the whole umalqura table), both PlainDate limits, and add(until()) round trips found no difference from 2e2aa2290f other than results that land in years below 1, plus one spec-mandated one: a Hijri PlainYearMonth.add whose result month starts past +275760-09-13 now throws RangeError like persian already did (CalendarDateAdd's ISODateWithinLimits step), where the ucal_add path returned it.

Sequencing with #606: both touch nonISODateUntil / surpassesMonths. If this lands first, #606 rebases onto the calendarHasFixedMonths / fixedMonth* names and drops islamic-* from its lunar month-count path, because here the Hijri calendars already take the closed-form fixed-month count and must not go back through ucal_add (its DAY_OF_MONTH pin is what produced -4-12-30 + P1Y = -2-01-30). A mechanical merge of the two does not compile.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Sep 9, 2026
…c7a17d2, comment-only change over 092e8258)
@robobun
robobun force-pushed the robobun/67280f13/temporal-tabular-calendars-before-epoch branch from 0c7a17d to 0837a0e Compare September 9, 2026 19:33
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@robobun

robobun commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (dfd6964, which Bun now pins) as 0837a0e. No change to the patch: nothing between 2e2aa22 and dfd6964 touches Source/JavaScriptCore/runtime/temporal/, so the cherry-pick applied as is. oven-sh/bun#42087 will move to the autobuild-preview-pr-598-0837a0ef preview once it is published.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Sep 9, 2026
…nth lengths (WebKit bump)

Bumps WEBKIT_VERSION to pick up oven-sh/WebKit#598 and adds tests to
test/js/web/temporal/temporal.test.ts.

ICU4C evaluates the tabular Hijri leap-year rule and the Persian one with a
truncating %, so for islamic-civil, islamic-tbla, islamic-umalqura and persian
every year below 1 read as leap: inLeapYear true, daysInYear 355 or 366 and a
30-day last month, while the next year starts 354 or 365 days later.
{year: -7, month: 12, day: 30} passed overflow "reject" and aliased
{year: -6, month: 1, day: 1}, -4-12-30 + P1Y gave -2-01-30 in the Hijri
calendars, and persian -1-11-30 + P1M threw a RangeError. The engine change
answers those lengths from the tabular rules with a floored remainder, as
icu4x does, and moves Hijri year and month arithmetic off ucal_add().
@robobun
robobun force-pushed the robobun/67280f13/temporal-tabular-calendars-before-epoch branch from 0837a0e to 18bf40c Compare September 12, 2026 08:40
@robobun

robobun commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (cf1b36e, which Bun main pins now) as 18bf40c. The patch is unchanged: Source/JavaScriptCore/runtime/temporal/core/ has the same tree hash at dfd6964 and cf1b36e (the upstream merge in #614 did not touch it), and the cherry-pick applied without a conflict. oven-sh/bun#42087 moves to the autobuild-preview-pr-598-18bf40c1 preview once it is published.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Sep 12, 2026
…nth lengths (WebKit bump)

Bumps WEBKIT_VERSION to pick up oven-sh/WebKit#598 and adds tests to
test/js/web/temporal/temporal.test.ts.

ICU4C evaluates the tabular Hijri leap-year rule and the Persian one with a
truncating %, so for islamic-civil, islamic-tbla, islamic-umalqura and persian
every year below 1 read as leap: inLeapYear true, daysInYear 355 or 366 and a
30-day last month, while the next year starts 354 or 365 days later.
{year: -7, month: 12, day: 30} passed overflow "reject" and aliased
{year: -6, month: 1, day: 1}, -4-12-30 + P1Y gave -2-01-30 in the Hijri
calendars, and persian -1-11-30 + P1M threw a RangeError. The engine change
answers those lengths from the tabular rules with a floored remainder, as
icu4x does, and moves Hijri year and month arithmetic off ucal_add().
… and month lengths

ICU4C's IslamicCivilCalendar::civilLeapYear() computes (14 + 11 * year) % 30 < 11 and
PersianCalendar::isLeapYear() computes (25 * year + 11) % 33 < 8 with the truncating %
(the Hijri one always did; the Persian one since ICU 75, where ICU-22633's
unicode-org/icu@d43d216feb replaced a ClockMath::floorDivide; both unchanged in ICU 78).
For a negative dividend (Hijri year <= -2, Persian year <= -1) the remainder is <= 0, so
every such year reads as leap: handleGetYearLength() says 355 or 366 and
handleGetMonthLength() gives the last month 30 days. yearStart() and monthStart()
floor-divide, so ICU still places the days themselves where icu4x does, and day 30 of a
29-day final month is the same day as the next year's day 1. islamic-umalqura uses the
civil rule outside its 1300-1600 AH table, so it is affected for the same years.

Through the Temporal calendar bridge, for islamic-civil, islamic-tbla, islamic-umalqura
and persian in years below 1, this showed up as:
- inLeapYear true, daysInYear 355 or 366 and a 30-day last month for common years,
  while until() to the next new year measures 354 or 365 days;
- {year: -7, month: 12, day: 30} accepted with overflow "reject", and equal to
  {year: -6, month: 1, day: 1};
- year and month arithmetic off by a month, because ucal_add() pins DAY_OF_MONTH
  against the same wrong length and lands in the next month: in the Hijri calendars
  -4-12-30 + P1Y gave -2-01-30 instead of -3-12-29, and persian -1-11-30 + P1M threw
  a RangeError.

For those years the bridge now takes daysInMonth, daysInYear, inLeapYear and the day
regulation in from(), with(), add(), subtract(), until() and since() from the tabular
leap rules with a floored remainder, as icu4x does. The three Hijri calendars have
twelve months every year, so they join the fixed-month arithmetic path that coptic,
ethiopic, ethioaa, indian and persian already use (balance the year and month, construct
the native fields directly, regulate the day) instead of ucal_add(), which is now used
by the lunisolar calendars only. The fixed-solar helpers are renamed fixed-month to
match. Years from 1 on, and every other calendar, are unchanged.

* JSTests/stress/temporal-tabular-calendars-before-epoch.js: Added. Year and month
  lengths against the distance to the next year and month for years -70..5, reject and
  constrain of day 30, year and month arithmetic across common and leap years, ISO
  dates checked against icu4x, and islamic-umalqura inside its table.
* Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp:
(JSC::TemporalCore::calendarUsesTabularLeapRule):
(JSC::TemporalCore::tabularLeapYear):
(JSC::TemporalCore::tabularDaysInYear):
(JSC::TemporalCore::tabularDaysInMonth):
(JSC::TemporalCore::tabularYearBelowOneAtCursor):
(JSC::TemporalCore::daysInMonthAtCursor): Added.
(JSC::TemporalCore::calendarDaysInMonth):
(JSC::TemporalCore::calendarDaysInYear):
(JSC::TemporalCore::calendarInLeapYear):
(JSC::TemporalCore::nonISOCalendarDateToISO):
(JSC::TemporalCore::setMonths): Read the month and year length through the helpers.
(JSC::TemporalCore::calendarHasFixedMonths): Renamed from calendarIsNonISOSolar; adds
  the Hijri calendars.
(JSC::TemporalCore::fixedMonthsInYear):
(JSC::TemporalCore::balanceFixedMonthYearMonth):
(JSC::TemporalCore::verifyAndCorrectFixedMonthDay):
(JSC::TemporalCore::setFixedMonthCalendarToYearMonth):
(JSC::TemporalCore::fixedMonthDateAdd): Renamed from the fixedSolar spellings.
(JSC::TemporalCore::calendarDateAdd):
(JSC::TemporalCore::surpassesMonths): Assert that the ucal_add() path is lunisolar.
@robobun

robobun commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto 9b02218 (#645, the commit Bun main pins now) as d31f1c5. The patch is unchanged: Source/JavaScriptCore/runtime/temporal/core/ has the same tree hash at cf1b36e, at 9b02218 and on main, and the cherry-pick applied without a conflict. With #645 the tested lanes now also run JSTests/stress/temporal-tabular-calendars-before-epoch.js. oven-sh/bun#42087 moves to the autobuild-preview-pr-598-d31f1c5a preview once it is published.

@robobun
robobun force-pushed the robobun/67280f13/temporal-tabular-calendars-before-epoch branch from 18bf40c to d31f1c5 Compare September 15, 2026 09:54

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

robobun added a commit to oven-sh/bun that referenced this pull request Sep 15, 2026
…nth lengths (WebKit bump)

Bumps WEBKIT_VERSION to pick up oven-sh/WebKit#598 and adds tests to
test/js/web/temporal/temporal.test.ts.

ICU4C evaluates the tabular Hijri leap-year rule and the Persian one with a
truncating %, so for islamic-civil, islamic-tbla, islamic-umalqura and persian
every year below 1 read as leap: inLeapYear true, daysInYear 355 or 366 and a
30-day last month, while the next year starts 354 or 365 days later.
{year: -7, month: 12, day: 30} passed overflow "reject" and aliased
{year: -6, month: 1, day: 1}, -4-12-30 + P1Y gave -2-01-30 in the Hijri
calendars, and persian -1-11-30 + P1M threw a RangeError. The engine change
answers those lengths from the tabular rules with a floored remainder, as
icu4x does, and moves Hijri year and month arithmetic off ucal_add().
@robobun

robobun commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

CI on d31f1c5 (the first run of this PR with the JavaScriptCore tests from #645): all 42 lanes built and the autobuild-preview-pr-598-d31f1c5a release is published. Test bun-webkit-linux-amd64-lto is green (about 120k test runs, 0 failures), so stress/temporal-tabular-calendars-before-epoch.js passes there in every mode. Test bun-webkit-linux-arm64-lto has one failure, stress/sampling-profiler-bound-function-name.js.ftl-eager-no-cjit, a sampling profiler test that does not touch Temporal or ICU. The new stress test is not in the failure list on arm64 either. I re-ran that job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant