Module calendrica-modern-civil
Modern civil calendars not covered by “Calendrical Calculations”.
This module collects widely used civil calendars that are not part of Dershowitz & Reingold’s Calendrical Calculations (and therefore not ported from CALENDRICA 4.0). Each calendar’s algorithm and source (with reference links) is documented with the relevant conversion functions below. All are built on the book’s Gregorian or Julian routines.
Calendars provided:
- Indian National calendar (reformed Śaka) — India’s official civil
calendar, defined by the Calendar Reform Committee (chaired by Meghnad Saha),
adopted 1957-03-22. Matches Unicode CLDR/ICU
indian. https://en.wikipedia.org/wiki/Indian_national_calendar - Minguo / Republic of China calendar — Taiwan’s official civil calendar;
Gregorian months and days with year numbering offset by 1911 (year 1 = 1912 CE).
Matches Unicode CLDR/ICU
roc. https://en.wikipedia.org/wiki/Republic_of_China_calendar - Thai solar calendar (Suriyakati, Buddhist Era) — Thailand’s official civil
calendar since 1941; Gregorian months and days with the Buddhist Era offset of
543 years. Matches Unicode CLDR/ICU
buddhist. https://en.wikipedia.org/wiki/Thai_solar_calendar - Revised Bengali calendar (Bangladesh) — Bangladesh’s national calendar as fixed by the Bangla Academy; arithmetic solar calendar locked to the Gregorian year. https://en.wikipedia.org/wiki/Bengali_calendars
- Nanakshahi calendar (Sikh) — the tropical solar calendar designed by Pal Singh Purewal, adopted by the SGPC in 2003. https://en.wikipedia.org/wiki/Nanakshahi_calendar
- Amazigh (Berber) calendar — the agrarian calendar of North Africa; the Julian calendar with years offset by 950. Yennayer (new year) is an official public holiday in Algeria and Morocco. https://en.wikipedia.org/wiki/Berber_calendar
- Japanese era calendar (nengō / wareki) — the modern Japanese civil calendar;
Gregorian months and days with years counted within the reigning emperor’s era.
Matches Unicode CLDR/ICU
japanese. https://en.wikipedia.org/wiki/Japanese_era_name
For ICU/CLDR calendar equivalences see the ICU calendar guide: https://unicode-org.github.io/icu/userguide/datetime/calendar/.
Info:
- Release: 0.2 2026-09-21
Functions
| fixed_from_indian_national (i_date) | Fixed date equivalent to the Indian National (reformed Śaka) date i_date. |
| indian_national_from_fixed (date) | Indian National (reformed Śaka) date {year, month, day} for fixed date. |
| fixed_from_roc (r_date) | Fixed date equivalent to the Minguo (ROC) date r_date. |
| roc_from_fixed (date) | Minguo (ROC) date {year, month, day} corresponding to fixed date. |
| fixed_from_thai_solar (t_date) | Fixed date equivalent to the Thai solar (Buddhist Era) date t_date. |
| thai_solar_from_fixed (date) | Thai solar (Buddhist Era) date {year, month, day} corresponding to fixed date. |
| fixed_from_bengali_revised (b_date) | Fixed date equivalent to the revised Bengali date b_date. |
| bengali_revised_from_fixed (date) | Revised Bengali date {year, month, day} corresponding to fixed date. |
| fixed_from_nanakshahi (n_date) | Fixed date equivalent to the Nanakshahi date n_date. |
| nanakshahi_from_fixed (date) | Nanakshahi date {year, month, day} corresponding to fixed date. |
| fixed_from_amazigh (a_date) | Fixed date equivalent to the Amazigh (Berber) date a_date. |
| amazigh_from_fixed (date) | Amazigh (Berber) date {year, month, day} corresponding to fixed date. |
| fixed_from_japanese_era (j_date) | Fixed date equivalent to the Japanese era date j_date. |
| japanese_era_from_fixed (date) | Japanese era date {era, year, month, day} corresponding to fixed date. |
| japanese_era_name (era_id) | Display name for Japanese era identifier era_id, or nil if unknown. |
Fields
| japanese_eras | Ordered list of modern gengō eras. |
Functions
- fixed_from_indian_national (i_date)
-
Fixed date equivalent to the Indian National (reformed Śaka) date
i_date.Parameters:
- i_date table Indian National date {year, month, day}.
Returns:
-
number
Fixed date.
- indian_national_from_fixed (date)
-
Indian National (reformed Śaka) date {year, month, day} for fixed
date.Parameters:
- date number Fixed date.
Returns:
-
table
{year, month, day}
- fixed_from_roc (r_date)
-
Fixed date equivalent to the Minguo (ROC) date
r_date.Parameters:
- r_date table Minguo date {year, month, day}.
Returns:
-
number
Fixed date.
- roc_from_fixed (date)
-
Minguo (ROC) date {year, month, day} corresponding to fixed
date.Parameters:
- date number Fixed date.
Returns:
-
table
{year, month, day}
- fixed_from_thai_solar (t_date)
-
Fixed date equivalent to the Thai solar (Buddhist Era) date
t_date.Parameters:
- t_date table Thai solar date {year, month, day}.
Returns:
-
number
Fixed date.
- thai_solar_from_fixed (date)
-
Thai solar (Buddhist Era) date {year, month, day} corresponding to fixed
date.Parameters:
- date number Fixed date.
Returns:
-
table
{year, month, day}
- fixed_from_bengali_revised (b_date)
-
Fixed date equivalent to the revised Bengali date
b_date.Parameters:
- b_date table Revised Bengali date {year, month, day}.
Returns:
-
number
Fixed date.
- bengali_revised_from_fixed (date)
-
Revised Bengali date {year, month, day} corresponding to fixed
date.Parameters:
- date number Fixed date.
Returns:
-
table
{year, month, day}
- fixed_from_nanakshahi (n_date)
-
Fixed date equivalent to the Nanakshahi date
n_date.Parameters:
- n_date table Nanakshahi date {year, month, day}.
Returns:
-
number
Fixed date.
- nanakshahi_from_fixed (date)
-
Nanakshahi date {year, month, day} corresponding to fixed
date.Parameters:
- date number Fixed date.
Returns:
-
table
{year, month, day}
- fixed_from_amazigh (a_date)
-
Fixed date equivalent to the Amazigh (Berber) date
a_date.Parameters:
- a_date table Amazigh date {year, month, day}.
Returns:
-
number
Fixed date.
- amazigh_from_fixed (date)
-
Amazigh (Berber) date {year, month, day} corresponding to fixed
date.Parameters:
- date number Fixed date.
Returns:
-
table
{year, month, day}
- fixed_from_japanese_era (j_date)
-
Fixed date equivalent to the Japanese era date
j_date.j_dateis{era, year, month, day}, whereerais a gengō era id ("meiji","taisho","showa","heisei","reiwa") or an inherited Gregorian era ("ce","bce"),yearis the year within the era (the first year is 1), andmonth/dayare Gregorian.Parameters:
- j_date table Japanese era date {era, year, month, day}.
Returns:
-
number
Fixed date.
Raises:
If the era identifier is unknown. - japanese_era_from_fixed (date)
-
Japanese era date {era, year, month, day} corresponding to fixed
date. Dates before the Meiji era use the inherited Gregorian eras"ce"/"bce".Parameters:
- date number Fixed date.
Returns:
-
table
{era, year, month, day}
- japanese_era_name (era_id)
-
Display name for Japanese era identifier
era_id, ornilif unknown. Covers the gengō eras plus the inherited"ce"and"bce".Parameters:
- era_id string Era identifier.
Returns:
-
string or nil
Display name, e.g.
"Reiwa","CE".