Module icu_calendar::coptic
source · Expand description
This module contains types and implementations for the Coptic calendar.
use icu::calendar::{coptic::Coptic, Date, DateTime};
// `Date` type
let date_iso = Date::try_new_iso_date(1970, 1, 2)
.expect("Failed to initialize ISO Date instance.");
let date_coptic = Date::new_from_iso(date_iso, Coptic);
// `DateTime` type
let datetime_iso = DateTime::try_new_iso_datetime(1970, 1, 2, 13, 1, 0)
.expect("Failed to initialize ISO DateTime instance.");
let datetime_coptic = DateTime::new_from_iso(datetime_iso, Coptic);
// `Date` checks
assert_eq!(date_coptic.year().number, 1686);
assert_eq!(date_coptic.month().ordinal, 4);
assert_eq!(date_coptic.day_of_month().0, 24);
// `DateTime` type
assert_eq!(datetime_coptic.date.year().number, 1686);
assert_eq!(datetime_coptic.date.month().ordinal, 4);
assert_eq!(datetime_coptic.date.day_of_month().0, 24);
assert_eq!(datetime_coptic.time.hour.number(), 13);
assert_eq!(datetime_coptic.time.minute.number(), 1);
assert_eq!(datetime_coptic.time.second.number(), 0);
Structs§
- The Coptic Calendar