CalendarSystem class

A calendar system maps the non-calendar-specific 'local time line' to human concepts such as years, months and days.

Many developers will never need to touch this class, other than to potentially ask a calendar how many days are in a particular year/month and the like. Time Machine defaults to using the ISO-8601 calendar anywhere that a calendar system is required but hasn't been explicitly specified.

If you need to obtain a CalendarSystem instance, use one of the static properties or methods in this class, such as the iso property or the GetHebrewCalendar(HebrewMonthNumbering) method.

Although this class is currently sealed (as of Time Machine 1.2), in the future this decision may be reversed. In any case, there is no current intention for third-party developers to be able to implement their own calendar systems (for various reasons). If you require a calendar system which is not currently supported, please file a feature request and we'll see what we can do.

Annotations
  • @immutable

Properties

eras Iterable<Era>
Gets a read-only list of eras used in this calendar system.
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
Returns the unique identifier for this calendar system. This is provides full round-trip capability using forId to retrieve the calendar system from the identifier.
final
maxYear int
Gets the maximum valid year (inclusive) within this calendar.
final
minYear int
Gets the minimum valid year (inclusive) within this calendar.
final
name String
Returns the name of this calendar system. Each kind of calendar system has a unique name, but this does not usually provide enough information for round-tripping. (For example, the name of an Islamic calendar system does not indicate which kind of leap cycle it uses.)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getAbsoluteYear(int yearOfEra, Era era) int
Returns the 'absolute year' (the one used throughout most of the API, without respect to eras) from a year-of-era and an era.
getDaysInMonth(int year, int month) int
Returns the number of days in the given month within the given year.
getDaysInYear(int year) int
Returns the number of days in the given year.
getMaxYearOfEra(Era era) int
Returns the maximum valid year-of-era in the given era.
getMinYearOfEra(Era era) int
Returns the minimum valid year-of-era in the given era.
getMonthsInYear(int year) int
Returns the maximum valid month (inclusive) within this calendar in the given year.
isLeapYear(int year) bool
Returns whether or not the given year is a leap year in this calendar.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Converts this calendar system to text by simply returning its unique ID.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

badi CalendarSystem
Returns the Wondrous (Badí') calendar, as described at https://en.wikipedia.org/wiki/Badi_calendar. This is a purely solar calendar with years starting at the vernal equinox.
no setter
coptic CalendarSystem
Returns a Coptic calendar system, which defines every fourth year as leap, much like the Julian calendar. The year is broken down into 12 months, each 30 days in length. An extra period at the end of the year is either 5 or 6 days in length. In this implementation, it is considered a 13th month.
no setter
gregorian CalendarSystem
Returns a Gregorian calendar system.
final
hebrewCivil CalendarSystem
Returns a Hebrew calendar system using the civil month numbering, equivalent to the one used by the BCL HebrewCalendar.
no setter
hebrewScriptural CalendarSystem
Returns a Hebrew calendar system using the scriptural month numbering.
no setter
ids Iterable<String>
Returns the IDs of all calendar systems available within Time Machine. The order of the keys is not guaranteed.
no setter
islamicBcl CalendarSystem
Returns an Islamic calendar system equivalent to the one used by the BCL HijriCalendar.
no setter
iso CalendarSystem
Returns a calendar system that follows the rules of the ISO-8601 standard, which is compatible with Gregorian for all modern dates.
final
julian CalendarSystem
Returns a pure proleptic Julian calendar system, which defines every fourth year as a leap year. This implementation follows the leap year rule strictly, even for dates before 8 CE, where leap years were actually irregular.
final
persianArithmetic CalendarSystem
Returns a Persian (also known as Solar Hijri) calendar system implementing the behaviour of the BCL PersianCalendar from .NET 4.6 onwards (and Windows 10), and the astronomical system described in Wikipedia and Calendrical Calculations.
no setter
persianAstronomical CalendarSystem
Returns a Persian (also known as Solar Hijri) calendar system implementing the behaviour proposed by Ahmad Birashk with nested cycles of years determining which years are leap years.
no setter
persianSimple CalendarSystem
Returns a Persian (also known as Solar Hijri) calendar system implementing the behaviour of the BCL PersianCalendar before .NET 4.6, and the sole Persian calendar in Time Machine 1.3.
no setter
umAlQura CalendarSystem
Returns an Um Al Qura calendar system - an Islamic calendar system primarily used by Saudi Arabia.
no setter

Static Methods

forId(String id) CalendarSystem
Fetches a calendar system by its unique identifier. This provides full round-tripping of a calendar system. It is not guaranteed that calling this method twice with the same identifier will return identical references, but the references objects will be equal.
getHebrewCalendar(HebrewMonthNumbering monthNumbering) CalendarSystem
Returns a Hebrew calendar, as described at http://en.wikipedia.org/wiki/Hebrew_calendar. This is a purely mathematical calculator, applied proleptically to the period where the real calendar was observational.
getIslamicCalendar(IslamicLeapYearPattern leapYearPattern, IslamicEpoch epoch) CalendarSystem
Returns an Islamic, or Hijri, calendar system.
getIslamicId(IslamicLeapYearPattern leapYearPattern, IslamicEpoch epoch) String