---
title: Calendars in ECMAScript
tags: 
author: [ふぁぼん](https://image.docswell.com/user/fabon)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/VJPKGQZWE8.jpg?width=480
description: https://nodejs.connpass.com/event/405664/ の発表スライド
published: September 29, 26
canonical: https://image.docswell.com/s/fabon/Z4NWYW-calendars-in-ecmascript
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/VJPKGQZWE8.jpg)

Calendars in ECMAScript
ふぁぼん / fabon


# Page. 2

![Page Image](https://bcdn.docswell.com/page/2EVV65W9EQ.jpg)

Who am I?
ふぁぼん / fabon
I love web standards and everything related to human languages, cultures, etc.
The author of temporal-polyfill-lite , the smallest polyfill (so far) for the Temporal API
https://npmx.dev/package/temporal-polyfill-lite
A graduate student studying modern Russian history
For historians, dealing with various languages, writing systems, calendars, and cultures is a daily task.


# Page. 3

![Page Image](https://bcdn.docswell.com/page/57GLN6D4EL.jpg)

Localization, Internationalization, Translation
These are different concepts.
I’ll explain them based on the W3C definition.
https://www.w3.org/International/questions/qa-i18n


# Page. 4

![Page Image](https://bcdn.docswell.com/page/4EQYQ41RJP.jpg)

Localization (l10n)
Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other
requirements of a specific target market (a locale).
日本語訳 (筆者):
ローカライズとは、プロダクトやソフトウェア、そして文書を特定マーケット（「ロケール」）の言語や各種の（文化などの）要件に適合
させる作業のことを指す。


# Page. 5

![Page Image](https://bcdn.docswell.com/page/KJ4WNQRQ71.jpg)

Localization (l10n)
Translation is part of localization.
Translation itself is harder than you might think, btw.
Dates, times, numerals, amounts
Keyboard layout and usage
e.g., problems related to input methods (mainly in Japanese, Chinese, and Korean)
Writing systems and fonts
RTL scripts (Arabic, Hebrew, Thaana, N’ko…)
Vertical writing
Some scripts can be written only vertically! (e.g., Mongolian script, Manchu alphabet)
Locale-dependent font selection for the same code points
CJK Unified Ideographs (the so-called &quot;Chinese font problem&quot; among Japanese speakers)
Some users may expect Urdu in Nastaliq style or Bulgarian in Bulgarian-styled Cyrillic


# Page. 6

![Page Image](https://bcdn.docswell.com/page/LE1Y5PQL7G.jpg)

Internationalization (i18n)
Internationalization is the design and development of a product, application or document content that enables easy localization for
target audiences that vary in culture, region, or language.
日本語訳 (筆者):
国際化はプロダクト、アプリケーション、文書を多様な文化・地域・言語のユーザーに合わせてローカライズしやすくする ための設
計・開発プロセスを指す。


# Page. 7

![Page Image](https://bcdn.docswell.com/page/GEWG52MQJ2.jpg)

Why is i18n important for web standards?
The web should work for everyone
Web standards should enable everyone to build their own websites and web apps
Web standards should embrace reality
Human languages are complicated
Human cultures are diverse


# Page. 8

![Page Image](https://bcdn.docswell.com/page/47ZLNDQ3J3.jpg)

Calendar support in ECMAScript
Formatting dates in non-Gregorian calendars via toLocaleString and Intl.DateTimeFormat
Date arithmetic for non-Gregorian calendars via Temporal
Design doc for calendar support in Temporal: https://tc39.es/proposal-temporal/docs/calendarreview.html
The API and arithmetic are consistent across calendars
An enormous effort was made to achieve this goal


# Page. 9

![Page Image](https://bcdn.docswell.com/page/YJ6W816ZJV.jpg)

What should ECMAScript specify about calendars?
A list of supported calendars (calendar IDs and what they actually mean)
Caveats for calendars that are not rule-based (calendar authorities and well-defined ranges)


# Page. 10

![Page Image](https://bcdn.docswell.com/page/GJ5M9469J4.jpg)

Definition of the chinese calendar:
Traditional Chinese calendar. Lunisolar calendar, based on data published by the Purple Mountain Observatory for dates between
1900 and 2100 (which complies with GB/T 33661-2017, Calculation and Promulgation of the Chinese Calendar), falling back to an
implementation-defined approximation outside that range. The arithmetic year is as in &quot;gregory&quot; , and there are no eras.
筆者訳:
伝統的な中国暦（農暦）。紫金山天文台の発行する暦のデータ（中国暦の計算・公布に関する標準であるGB/T 33661-2017に基づく）に
1900〜2100年の間は準拠し、その外では実装依存の近似計算にフォールバックする。arithmetic yearは &quot;gregory&quot; と同様で、時代・
年号は存在しない。
Note: arithmetic year is the year number in Temporal.PlainDate.prototype.year


# Page. 11

![Page Image](https://bcdn.docswell.com/page/LE3WYGQ2E5.jpg)

Every Calendar in ECMAScript Explained in `$rest` minutes


# Page. 12

![Page Image](https://bcdn.docswell.com/page/8EDK51967G.jpg)

more precisely (in MessageFormat2):
.input {$rest_minute :number}
.match $rest_minute
one {{Every Calendar in ECMAScript Explained in {$rest_minute} minute}}
* {{Every Calendar in ECMAScript Explained in {$rest_minute} minutes}}


# Page. 13

![Page Image](https://bcdn.docswell.com/page/V7PKGQ9ZJ8.jpg)

Astronomical constants
solar year: 365.24 days
in solar calendars, a normal year has 365 days and a leap year (almost once every 4 years) has 366
days
lunar month: 29.53 days
in a lunar calendar, a month has 29 or 30 days
12 lunar months: 354.36 days (shorter than the solar year)
in a lunisolar calendar, leap months are inserted to minimize the gap


# Page. 14

![Page Image](https://bcdn.docswell.com/page/2JVV65MMJQ.jpg)

iso8601 and gregory
the Gregorian calendar
iso8601 is a culturally &quot;neutral&quot; model
gregory refers to the Gregorian calendar in the real world
I wrote a detailed article about them recently
https://dnevnik.fabon.info/posts/2026/09/14/gregory-vs-iso8601/


# Page. 15

![Page Image](https://bcdn.docswell.com/page/5EGLN6GXJL.jpg)

buddhist and roc
Based on the Gregorian calendar, except for eras
buddhist : the proleptic Gregorian calendar with the Buddhist era (
仏滅紀元) used in Thailand
AD (CE) 2026 = BE 2569
Thailand officially used a lunisolar calendar before 1941
roc : the proleptic Gregorian calendar with the ROC era (
民國紀年 / 民国紀年)
1912 as year 1
China officially used a lunisolar calendar (the chinese calendar) before 1912


# Page. 16

![Page Image](https://bcdn.docswell.com/page/4JQYQ4X57P.jpg)

japanese
The proleptic Gregorian calendar with the Japanese regnal year system (gengō)
Only modern eras ( meiji , taisho , showa , heisei , reiwa )
era IDs are based on CLDR
Eras and their date ranges are hardcoded into the ECMA-402 spec
Fallback to &quot;gregory&quot; before 1872 (the 6th year of the Meiji era)
Japan officially used a lunisolar calendar before 1872


# Page. 17

![Page Image](https://bcdn.docswell.com/page/K74WNQ6VE1.jpg)

What will happen when the Japanese government
changes the era?
The ID of the new era will be added to the CLDR data
It will be the same as the official English spelling proposed by the government
The normative change for the new era addition based on CLDR will be agreed upon in a TC39 meeting
and merged into ECMA-402
ICU4C and ICU4X will add support for the new era
JavaScript engines and browsers pull upstream ICU changes to support the new era
or patch the JavaScript engine as a temporary solution
The order of steps may vary.


# Page. 18

![Page Image](https://bcdn.docswell.com/page/LJ1Y5PV4EG.jpg)

coptic , ethioaa , and ethiopic
30 days * 12 months + 5 days (6 days in leap years)
Extra days are treated as a 13th month ( M13 ) in Temporal
The rule for leap years is the same as in the Julian calendar
Same date, but different year numbering


# Page. 19

![Page Image](https://bcdn.docswell.com/page/GJWG52LZ72.jpg)

indian
Indian national calendar (
インド国定暦)
different from traditional Indian calendars
Years are counted in the Shaka era
The rule for leap years is the same as in the Gregorian calendar


# Page. 20

![Page Image](https://bcdn.docswell.com/page/4EZLNDML73.jpg)

persian
Solar Hijri calendar
based on the Hijrah epoch
Calendar authority: the Iranian government
New year begins on every vernal equinox


# Page. 21

![Page Image](https://bcdn.docswell.com/page/Y76W81NM7V.jpg)

Islamic calendar
Lunar calendar without leap months
The year is 354 or 355 days long (shorter than the solar year)
the calendar drifts backward through the Gregorian calendar by about 10 days each year


# Page. 22

![Page Image](https://bcdn.docswell.com/page/G75M945Q74.jpg)

islamic-civil , islamic-tbla
islamic-tbla : rule-based (tabular) Islamic calendar used in some countries and regions
islamic-civil : almost the same as islamic-tbla (one-day difference)
I don’t know the actual usage of islamic-civil


# Page. 23

![Page Image](https://bcdn.docswell.com/page/9J292VNWER.jpg)

islamic-umalqura
Umm al-Qura Calendar
Islamic calendar based on astronomical simulation for civil use in Saudi Arabia
well-defined range: 1300 AH to the end of 1600 AH (corresponding to 1882-2182 CE)
based on the calendar published by the government of Saudi Arabia
Fallback to islamic-civil outside that range
Note: Saudi Arabia uses an Islamic calendar based on actual moon sightings to determine Islamic
holidays, not the Umm al-Qura Calendar


# Page. 24

![Page Image](https://bcdn.docswell.com/page/DEY4Y3P9JM.jpg)

hebrew
the Hebrew calendar
a rule-based lunisolar calendar
the rules are very complicated
has leap months


# Page. 25

![Page Image](https://bcdn.docswell.com/page/VJNYPV5D78.jpg)

chinese and dangi
traditional East Asian lunisolar calendars
leap months are inserted to fill the gap between 12 lunar months and 1 solar year
once every 2 or 3 years
chinese : used in China and Taiwan
implementation-defined before 1900 and after 2100
calendar authority: PRC
dangi : used in South Korea
implementation-defined before 1900 and after 2050


# Page. 26

![Page Image](https://bcdn.docswell.com/page/YE9P36Y8J3.jpg)

Links
https://tc39.es/proposal-intl-era-monthcode/
https://tc39.es/proposal-temporal/docs/calendar-review.html
https://dnevnik.fabon.info/posts/2026/09/14/gregory-vs-iso8601/


