Module icu_calendar::islamic
source ยท Expand description
This module contains types and implementations for the Islamic calendars.
use icu::calendar::islamic::IslamicObservational;
use icu::calendar::{Date, DateTime, Ref};
let islamic = IslamicObservational::new_always_calculating();
let islamic = Ref(&islamic); // to avoid cloning
// `Date` type
let islamic_date =
Date::try_new_observational_islamic_date(1348, 10, 11, islamic)
.expect("Failed to initialize islamic Date instance.");
// `DateTime` type
let islamic_datetime = DateTime::try_new_observational_islamic_datetime(
1348, 10, 11, 13, 1, 0, islamic,
)
.expect("Failed to initialize islamic DateTime instance.");
// `Date` checks
assert_eq!(islamic_date.year().number, 1348);
assert_eq!(islamic_date.month().ordinal, 10);
assert_eq!(islamic_date.day_of_month().0, 11);
// `DateTime` checks
assert_eq!(islamic_datetime.date.year().number, 1348);
assert_eq!(islamic_datetime.date.month().ordinal, 10);
assert_eq!(islamic_datetime.date.day_of_month().0, 11);
assert_eq!(islamic_datetime.time.hour.number(), 13);
assert_eq!(islamic_datetime.time.minute.number(), 1);
assert_eq!(islamic_datetime.time.second.number(), 0);
Structsยง
- Civil / Arithmetical Islamic Calendar (Used for administrative purposes)
- The inner date type used for representing
Date
s ofIslamicCivil
. SeeDate
andIslamicCivil
for more details. - The inner date type used for representing
Date
s ofIslamicObservational
. SeeDate
andIslamicObservational
for more details. - Islamic Observational Calendar (Default)
- Contains any loaded precomputed data. If constructed with Default, will not contain any extra data and will always compute stuff from scratch
- A Tabular version of the Arithmetical Islamic Calendar
- The inner date type used for representing
Date
s ofIslamicTabular
. SeeDate
andIslamicTabular
for more details. - Umm al-Qura Hijri Calendar (Used in Saudi Arabia)
- The inner date type used for representing
Date
s ofIslamicUmmAlQura
. SeeDate
andIslamicUmmAlQura
for more details. - IslamicYearInfo ๐
Enumsยง
- IslamicYearLength ๐Compact representation of the length of an Islamic year.
Functionsยง
- compute_month_day ๐Given a year info and the first month it is possible for this date to be in, return the month and day this is in