pub struct Indian;Expand description
The Indian National (Śaka) Calendar
The Indian National calendar is a solar calendar created by the Indian government.
This implementation extends proleptically for dates before the calendar’s creation in 1879 Śaka (1957 CE).
This corresponds to the "indian" CLDR calendar.
§Era codes
This calendar uses a single era code: shaka, with Śaka 0 being 78 CE. Dates before this era use negative years.
§Months and days
The 12 months are called Chaitra (M01, 30 days), Vaisakha (M02, 31 days),
Jyaishtha (M03, 31 days), Ashadha (M04, 31 days), Sravana (M05, 31 days),
Bhadra (M06, 31 days), Asvina (M07, 30 days), Kartika (M08, 30 days),
Agrahayana or Margasirsha (M09, 30 days), Pausha (M10, 30 days), Magha (M11, 30 days),
Phalguna (M12, 30 days).
In leap years (years where the concurrent Gregorian year (year + 78) is leap),
Chaitra gains a 31st day.
Standard years thus have 365 days, and leap years 366.
§Calendar drift
The Indian calendar has the same year lengths and leap year rules as the Gregorian calendar, so it experiences the same drift of 1 day in ~7700 years with respect to the seasons.
Implementations§
Trait Implementations§
Source§impl Calendar for Indian
impl Calendar for Indian
Source§type DateInner = IndianDateInner
type DateInner = IndianDateInner
Source§type DifferenceError = Infallible
type DifferenceError = Infallible
untilSource§fn from_codes(
&self,
era: Option<&str>,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<Self::DateInner, DateError>
fn from_codes( &self, era: Option<&str>, year: i32, month_code: MonthCode, day: u8, ) -> Result<Self::DateInner, DateError>
Source§fn has_cheap_iso_conversion(&self) -> bool
fn has_cheap_iso_conversion(&self) -> bool
from_iso/to_iso is more efficient
than from_rata_die/to_rata_die.Source§fn months_in_year(&self, date: &Self::DateInner) -> u8
fn months_in_year(&self, date: &Self::DateInner) -> u8
Source§fn days_in_year(&self, date: &Self::DateInner) -> u16
fn days_in_year(&self, date: &Self::DateInner) -> u16
Source§fn days_in_month(&self, date: &Self::DateInner) -> u8
fn days_in_month(&self, date: &Self::DateInner) -> u8
Source§fn is_in_leap_year(&self, date: &Self::DateInner) -> bool
fn is_in_leap_year(&self, date: &Self::DateInner) -> bool
Source§fn month(&self, date: &Self::DateInner) -> MonthInfo
fn month(&self, date: &Self::DateInner) -> MonthInfo
dateSource§fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
dateSource§fn day_of_year(&self, date: &Self::DateInner) -> DayOfYear
fn day_of_year(&self, date: &Self::DateInner) -> DayOfYear
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Source§fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
CalendarAlgorithm that is required to match
when parsing into this calendar. Read moreSource§fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner
fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner
Source§fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner
fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner
Source§fn extended_year(&self, date: &Self::DateInner) -> i32
fn extended_year(&self, date: &Self::DateInner) -> i32
Source§impl DateFieldsResolver for Indian
impl DateFieldsResolver for Indian
Source§type YearInfo = i32
type YearInfo = i32
fn days_in_provided_month(year: i32, month: u8) -> u8
fn months_in_provided_year(_: i32) -> u8
Source§fn year_info_from_era(
&self,
era: &[u8],
era_year: i32,
) -> Result<Self::YearInfo, UnknownEraError>
fn year_info_from_era( &self, era: &[u8], era_year: i32, ) -> Result<Self::YearInfo, UnknownEraError>
Source§fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo
fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo
Source§fn reference_year_from_month_day(
&self,
month_code: ValidMonthCode,
day: u8,
) -> Result<Self::YearInfo, EcmaReferenceYearError>
fn reference_year_from_month_day( &self, month_code: ValidMonthCode, day: u8, ) -> Result<Self::YearInfo, EcmaReferenceYearError>
Source§fn ordinal_month_from_code(
&self,
_year: &Self::YearInfo,
month_code: ValidMonthCode,
_options: DateFromFieldsOptions,
) -> Result<u8, MonthCodeError>
fn ordinal_month_from_code( &self, _year: &Self::YearInfo, month_code: ValidMonthCode, _options: DateFromFieldsOptions, ) -> Result<u8, MonthCodeError>
Source§fn month_code_from_ordinal(
&self,
_year: &Self::YearInfo,
ordinal_month: u8,
) -> ValidMonthCode
fn month_code_from_ordinal( &self, _year: &Self::YearInfo, ordinal_month: u8, ) -> ValidMonthCode
Source§impl From<Indian> for AnyCalendar
impl From<Indian> for AnyCalendar
Source§fn from(value: Indian) -> AnyCalendar
fn from(value: Indian) -> AnyCalendar
Source§impl IntoAnyCalendar for Indian
impl IntoAnyCalendar for Indian
Source§fn to_any(self) -> AnyCalendar
fn to_any(self) -> AnyCalendar
AnyCalendar, moving it Read moreSource§fn kind(&self) -> AnyCalendarKind
fn kind(&self) -> AnyCalendarKind
AnyCalendarKind enum variant associated with this calendarSource§fn from_any(any: AnyCalendar) -> Result<Self, AnyCalendar>
fn from_any(any: AnyCalendar) -> Result<Self, AnyCalendar>
Source§fn from_any_ref(any: &AnyCalendar) -> Option<&Self>
fn from_any_ref(any: &AnyCalendar) -> Option<&Self>
Source§fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
AnyDateInner Read more