NAME
Time::Keeper::Calendar - the calendars Time::Keeper values can be read in
VERSION
Version 0.11
SYNOPSIS
use Time::Keeper;
Time::Keeper::Calendar->ids; # gregory, buddhist, japanese, ...
Time::Keeper::Calendar->name('hebrew'); # Hebrew
Time::Keeper::Calendar->kind('islamic-umalqura'); # tabular
Time::Keeper::Calendar->eras('japanese'); # era0 .. meiji taisho showa heisei reiwa
Time::Keeper::Calendar->months_in_year('hebrew', 5784); # 13
Time::Keeper::Calendar->days_in_month('hebrew', 5784, 'M05L'); # 30
Time::Keeper::Calendar->is_leap_year('persian', 1403);
Time::Keeper::Calendar->preferred('TH'); # buddhist gregory
Time::Keeper::Calendar->era_start('japanese', 'reiwa'); # 2019-05-01, a Time::Keeper::Date
DESCRIPTION
Questions about a calendar that need no value: its id and English name, how it is computed, its eras, and the shape of a year. The calendars themselves are described under "CALENDARS" in Time::Keeper; a value is read in one with "in_calendar" in Time::Keeper or made in one with calendar on any constructor.
CLASS METHODS
ids
The seventeen ids, in the engine's order: gregory, buddhist, japanese, roc, coptic, ethiopic, ethioaa, hebrew, islamic-civil, islamic-tbla, islamic-umalqura, islamic, islamic-rgsa, persian, indian, chinese, dangi. Every method that takes an id also takes iso8601 and gregorian for gregory, ethiopic-amete-alem for ethioaa and islamicc for islamic-civil, in any case.
name
kind
canonical
Time::Keeper::Calendar->name('roc'); # Minguo
Time::Keeper::Calendar->kind('hebrew'); # arithmetic
Time::Keeper::Calendar->canonical('gregorian'); # gregory
CLDR's English name; arithmetic, tabular (Umm al-Qura, from Saudi Arabia's table) or astronomical (the four that follow the moon and the sun, read from tables of what ICU computes for the years 1000 to 3000); the id an alias stands for.
eras
The era codes, earliest first: bce and ce, be, the 237 Japanese eras (CLDR names the last five, meiji to reiwa; the rest are era0 to era231 by CLDR's index until a later release brings their names), broc and roc, before-am and am, aa and am, ah, ap, shaka.
months_in_year
days_in_month
days_in_year
is_leap_year
month_code
Time::Keeper::Calendar->months_in_year('hebrew', 5784); # 13
Time::Keeper::Calendar->days_in_month('coptic', 1740, 13); # 6
Time::Keeper::Calendar->days_in_month('hebrew', 5784, 'M05L'); # 30, Adar I
Time::Keeper::Calendar->days_in_year('islamic-civil', 1445); # 355
Time::Keeper::Calendar->is_leap_year('indian', 1946);
Time::Keeper::Calendar->month_code('hebrew', 5784, 6); # M05L
The shape of a year, by the calendar's continuous year and ordinal month; days_in_month also takes a month code.
preferred
my @ids = Time::Keeper::Calendar->preferred('TH'); # buddhist gregory
my @ids = Time::Keeper::Calendar->preferred('zh-Hant'); # gregory roc chinese
The calendars a territory uses, most preferred first, from CLDR's preference data: a territory is two capital letters or three digits (001 is the world), and a locale code gives its territory's list, the territory it names or, when it names none, the one CLDR thinks its language is likely in (ko is Korea, zh-Hant Taiwan). A territory CLDR says nothing of gets the world's list, the Gregorian alone. The default calendar of a value is never taken from this; see "CALENDARS" in Time::Keeper.
era_start
Time::Keeper::Calendar->era_start('japanese', 'reiwa'); # 2019-05-01
The first day of an era, as a Time::Keeper::Date; undef for an era with no beginning (bce, broc). The code is matched in any case.
names
my @months = Time::Keeper::Calendar->names('hebrew', 'he', 'months');
my @eras = Time::Keeper::Calendar->names('japanese', 'ja', 'eras', 'abbreviated');
The calendar's names in a locale: "names" in Time::Keeper::Locale with the calendar given, the id first and the locale second, then months, eras or cyclic_years, a width and a context.
SEE ALSO
AUTHOR
LNATION, <email at lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)