The engine-internal calendar core (RecursiveAI.OneEcma.Intl.Calendars.CalendarSystem) converts between epoch days
(days since 1970-01-01, proleptic Gregorian) and dates of every ECMA-402 calendar type: iso8601, gregory,
buddhist, japanese, roc, chinese, dangi, hebrew, islamic-civil, islamic-tbla, islamic-umalqura,
persian, indian, coptic, ethiopic and ethioaa (aliases islamicc, ethiopic-amete-alem).
All calendars are proleptic. Years are the arithmetic years of the era and monthCode proposal (Table 4), which can
be zero or negative; months are 1-based ordinal positions in the year, so they shift in years with a leap month;
month codes are M01..M13 and MnnL for a leap month. Eras and their aliases follow Table 2 of that proposal.
| Calendar | Rule |
|---|---|
| gregory, buddhist, roc, japanese | Gregorian months and leap rule; year offsets 0, +543, -1911; japanese eras from 1873 (Meiji 6) |
| coptic, ethiopic, ethioaa | 12 months of 30 days plus 5 or 6 epagomenal days; leap when year mod 4 = 3 (ethioaa: Mihret year = year - 5500) |
| indian | Saka year N begins on March 22 (March 21 when N+78 is a Gregorian leap year) |
| persian | 33-year arithmetic rule (leap when (25y+11) mod 33 < 8); the authority's published years for 1206 to 1498 AP agree with it |
| islamic-civil, islamic-tbla | tabular Hijri, Friday and Thursday epochs |
| islamic-umalqura | published month lengths for 1300 to 1600 AH (UmalquraTable, generated by tools/calendar-data/gen-umalqura.mjs); civil rules continue from both edges |
| hebrew | molad arithmetic with the four postponements; Tishrei is month 1, Adar I is M05L |
| chinese, dangi | computed astronomically: new moons and the apparent solar longitude (Meeus series, Espenak and Meeus delta-T), month 11 contains the winter solstice, the first month without a major solar term in a 13-month span is the leap month; the arithmetic year is the ISO year of the first month |
The lunisolar calendars decide the day of each new moon in China Standard Time (UT+7:45:40 before 1929, UT+8 after) or, for dangi, in Korea's zone (UT+8 before 1912, UT+9, UT+8:30 from 1954-03-21 to 1961-08-09, then UT+9). Outside 1900 to 2100 they are approximations. Floating-point rounding can, in principle, move a new moon that falls within a few seconds of local midnight; results are otherwise identical on every platform.
Checked against Node's Intl.DateTimeFormat for every day from 1900 to 2100: identical for all calendars except
chinese (11 month boundaries) and dangi (4), where a new moon or solar term falls within minutes of local midnight and
the astronomical result is used.
Formatting in every calendar
Intl.DateTimeFormat formats in each of these calendars for every CLDR 48 locale. A locale blob has one cal-<name> section per calendar it has data for: month, era and cyclic-year names, month patterns (leap-month forms), date formats, available formats and date-time glue; iso8601 comes from the root. The calendar a locale uses by default follows the region (CalendarPreference): gregory for most, islamic-umalqura for ar-SA, buddhist for th, persian for fa, and so on. Weekday names, day periods and time patterns are always the Gregorian ones, and a calendar's available formats stand alone (they are not mixed with the Gregorian ones). Resolved fields carry the era, the era year, the month key and whether the month is a leap month, which produce the era, relatedYear and yearName parts. Digit overrides that a calendar pattern requests with numbers= (Han day numerals for chinese and dangi in ja, zh and yue, Hebrew numerals, Japanese year numerals, lowercase Roman numerals for haw) are not applied: the pattern's numbering system is the one of the formatter. A probe of 16 calendars in en, ar, ja and zh against Node differs only there.