Implement non-ISO calendar support for Temporal (Chinese, Dangi, Hebrew, Persian) by lahma · Pull Request #2342 · sebastienros/jint (original) (raw)

and others added 6 commits

March 21, 2026 17:14

@lahma @claude

Add calendar arithmetic for Chinese, Dangi, Hebrew, and Persian calendars using .NET's built-in System.Globalization.Calendar classes.

New NonIsoCalendars adapter handles ISO↔calendar date conversion, calendar-aware field accessors (month, monthCode, day, daysInMonth, monthsInYear, inLeapYear), date arithmetic preserving monthCode semantics across leap months, and calendar date difference calculation.

Key changes:

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@lahma @claude

… validation

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@lahma @claude

Hebrew calendar uses a 19-year Metonic cycle where years 3, 6, 8, 11, 14, 17, 19 are leap years. This allows correct leap year detection for Hebrew years outside .NET HebrewCalendar's range (5343-5999).

Fixes GetLeapMonthOrdinal and GetMonthsInYear to use algorithmic detection as fallback, enabling CalendarDateAdd to correctly reject adding years to leap months when the target year isn't a leap year.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@lahma @claude

…ions

93,300 test262 tests pass, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@lahma @claude

For non-ISO calendars, ordinal month number does not equal the display month in monthCode (e.g., month 5 = M04L in Chinese calendar with leap month). The ISO-specific validation that checks month == monthFromCode must be skipped for non-ISO calendars where CalendarDateToISO handles the resolution.

Applied to all 5 constructors: PlainDate, PlainDateTime, PlainMonthDay, PlainYearMonth, ZonedDateTime.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@lahma @claude

Update CreatePlainDateFromFields and CreateZonedDateTimeFromFields in TemporalHelpers to use CalendarDateToISO for non-ISO calendars and skip ordinal/display month consistency checks.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

This was referenced

Mar 23, 2026

This was referenced

Jun 8, 2026

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})