pyoda_time.calendars package¶
Module contents¶
- class pyoda_time.calendars.CalendarWeekRule¶
Bases:
IntEnumAnalogous to the
CalendarWeekRuleenum found in the .NET framework.- FIRST_DAY = 0¶
- FIRST_FOUR_DAY_WEEK = 2¶
- FIRST_FULL_WEEK = 1¶
- __new__(value)¶
- class pyoda_time.calendars.Era¶
Bases:
objectRepresents an era used in a calendar.
All the built-in calendars in Pyoda Time use the values specified by the classmethods in this class. These may be compared for reference equality to check for specific eras.
- class property anno_hegirae: Era¶
The “Anno Hegira” era.
This is the sole era used in the Hijri (Islamic) calendar.
- class property anno_martyrum: Era¶
The “Anno Martyrum” or “Era of the Martyrs”.
This is the sole era used in the Coptic calendar.
- class property anno_mundi: Era¶
The “Anno Mundi” era.
This is the sole era used in the Hebrew calendar.
- class property anno_persico: Era¶
The “Anno Persico” era.
This is the sole era used in the Persian calendar.
- class property before_common: Era¶
The “before common” era (BCE), also known as Before Christ (BC).
This is used in the ISO, Gregorian and Julian calendars.
- class property common: Era¶
The “Common” era (CE), also known as Anno Domini (AD).
This is used in the ISO, Gregorian and Julian calendars.
- __init__() None¶
Raise TypeError if the decorated class has no public constructor.
- Raises:
TypeError – This class is not intended to be instantiated directly.
- __new__() T¶
Raise TypeError if the decorated class has no public constructor.
- Raises:
TypeError – This class is not intended to be instantiated directly.
- property name: str¶
Return the name of this era, e.g. “CE” or “BCE”.
- class pyoda_time.calendars.HebrewMonthNumbering¶
Bases:
IntEnumThe month numbering to use for the Hebrew calendar.
When requesting a Hebrew calendar with
CalendarSystem.get_hebrew_calendar(), a month numbering system needs to be specified. There are two main ways of numbering the Hebrew months: the civil system where month 1 is the start of the new year (Tishri) and scriptural system where month 1 is Nisan, according to biblical custom.- CIVIL = 1¶
- SCRIPTURAL = 2¶
- __new__(value)¶
- class pyoda_time.calendars.IWeekYearRule¶
Bases:
Protocol- __init__(*args, **kwargs)¶
- get_local_date(week_year: int, week_of_week_year: int, day_of_week: IsoDayOfWeek, calendar: CalendarSystem | None = None) LocalDate¶
- get_weeks_in_week_year(week_year: int, calendar: CalendarSystem | None = None) int¶
- class pyoda_time.calendars.IslamicEpoch¶
Bases:
IntEnumThe epoch to use when constructing an Islamic calendar.
The Islamic, or Hijri, calendar can either be constructed starting on July 15th 622CE (in the Julian calendar) or on the following day. The former is the “astronomical” or “Thursday” epoch; the latter is the “civil” or “Friday” epoch.
- ASTRONOMICAL = 1¶
- CIVIL = 2¶
- __new__(value)¶
- class pyoda_time.calendars.IslamicLeapYearPattern¶
Bases:
IntEnumThe pattern of leap years to use when constructing an Islamic calendar.
The Islamic, or Hijri, calendar is a lunar calendar of 12 months, each of 29 or 30 days. The calendar can be defined in either observational or tabular terms; Noda Time implements a tabular calendar, where a pattern of leap years (in which the last month has an extra day) repeats every 30 years, according to one of the patterns within this enum.
While the patterns themselves are reasonably commonly documented (see e.g. https://en.wikipedia.org/wiki/Tabular_Islamic_calendar) there is little standardization in terms of naming the patterns. I hope the current names do not cause offence to anyone; suggestions for better names would be welcome.
- BASE15 = 1¶
- BASE16 = 2¶
- HABASH_AL_HASIB = 4¶
- INDIAN = 3¶
- __new__(value)¶
- class pyoda_time.calendars.WeekYearRules¶
Bases:
objectFactory methods to construct week-year rules supported by Noda Time.
- class property iso: IWeekYearRule¶
Returns an
IWeekYearRuleconsistent with ISO-8601.In the standard ISO-8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year. In ISO-8601, weeks always begin on a Monday, so this rule is equivalent to the first Thursday being in the first Monday-to-Sunday week of the year.
For example, January 1st 2011 was a Saturday, so only two days of that week (Saturday and Sunday) were in 2011. Therefore January 1st is part of week 52 of week-year 2010. Conversely, December 31st 2012 is a Monday, so is part of week 1 of week-year 2013.
- Returns:
A
IWeekYearRuleconsistent with ISO-8601.
- static for_min_days_in_first_week(min_days_in_first_week: int, first_day_of_week: IsoDayOfWeek | None = None) IWeekYearRule¶
- static from_calendar_week_rule(calendar_week_rule: CalendarWeekRule, first_day_of_week: IsoDayOfWeek) IWeekYearRule¶