Module icu_calendar::ethiopian
source · Expand description
This module contains types and implementations for the Ethiopian calendar.
use icu::calendar::{ethiopian::Ethiopian, Date, DateTime};
// `Date` type
let date_iso = Date::try_new_iso_date(1970, 1, 2)
.expect("Failed to initialize ISO Date instance.");
let date_ethiopian = Date::new_from_iso(date_iso, Ethiopian::new());
// `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_ethiopian =
DateTime::new_from_iso(datetime_iso, Ethiopian::new());
// `Date` checks
assert_eq!(date_ethiopian.year().number, 1962);
assert_eq!(date_ethiopian.month().ordinal, 4);
assert_eq!(date_ethiopian.day_of_month().0, 24);
// `DateTime` type
assert_eq!(datetime_ethiopian.date.year().number, 1962);
assert_eq!(datetime_ethiopian.date.month().ordinal, 4);
assert_eq!(datetime_ethiopian.date.day_of_month().0, 24);
assert_eq!(datetime_ethiopian.time.hour.number(), 13);
assert_eq!(datetime_ethiopian.time.minute.number(), 1);
assert_eq!(datetime_ethiopian.time.second.number(), 0);
Structs§
Enums§
- Which era style the ethiopian calendar uses
Constants§
- The number of years the Amete Alem epoch precedes the Amete Mihret epoch