Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 284afdacfb77ee797e4874af70539b8b8b3b16d9
      
https://github.com/WebKit/WebKit/commit/284afdacfb77ee797e4874af70539b8b8b3b16d9
  Author: Yijia Huang <[email protected]>
  Date:   2026-08-10 (Mon, 10 Aug 2026)

  Changed paths:
    A JSTests/stress/temporal-lunisolar-extreme-year-arithmetic.js
    A JSTests/stress/temporal-plainyearmonth-toplaindate-day-range.js
    M Source/JavaScriptCore/runtime/TemporalPlainYearMonthPrototype.cpp
    M Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp

  Log Message:
  -----------
  [JSC][Temporal] Fix non-ISO date field resolution at the range edges
https://bugs.webkit.org/show_bug.cgi?id=321414
rdar://184478785

Reviewed by Yusuke Suzuki.

toPlainDate's non-ISO branch narrowed day to uint8_t, so day mod 256 decided 
the answer,
and both clamps in nonISOCalendarDateToISO were one-sided, letting the wrapped 
0 build a
live PlainDate with day 00:

PlainYearMonth.from({ year: 2567, month: 1, calendar: "buddhist" })
       .toPlainDate({ day: 256 })     // 2024-01-00, want 2024-01-31

day is saturated with clampTo<uint8_t> now and both clamps are two-sided. V8 and
SpiderMonkey agree.

calendarDateAdd and calendarDateUntil queried ICU past the range where its 
astronomical
output is trustworthy, though the chinese and dangi getters already report 
plain ISO fields
there, so add({years: 1}) on {calendar: "chinese", year: 270000} threw on a 
date that
constructs and reads fine. Both take the ISO path past the threshold now. That 
range is a
deliberate divergence, so the values are not expected to match V8; only the 
absence of a
failure is.

calendarDateUntil passed the calendar's arithmetic year to 
resolveMonthCodeToOrdinal, whose
year argument is the related year -- for chinese and dangi a different number 
on ICU 76
(4661 against 2024, 4353 against 2020) and the same one on ICU 78, so a local 
run cannot
tell them apart. The snapshot carries the related year separately now, computed 
from the
year's start instant rather than read from an ICU year field, and only the 
source endpoint
computes it because only the year loop consumes it. Comparisons still use the 
arithmetic
year, so both operands of one always come from the same field. Nothing branches 
on an ICU
version.

Tests: JSTests/stress/temporal-lunisolar-extreme-year-arithmetic.js
       JSTests/stress/temporal-plainyearmonth-toplaindate-day-range.js

Canonical link: https://commits.webkit.org/318940@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to