Module icu_calendar::chinese_based
source ยท Expand description
This module contains types and traits for use in the Chinese traditional lunar calendar, as well as in related and derived calendars such as the Korean and Vietnamese lunar calendars.
use icu::calendar::{chinese::Chinese, Date, Iso};
let iso_date = Date::try_new_iso_date(2023, 6, 23).unwrap();
let chinese_date = Date::new_from_iso(iso_date, Chinese::new());
assert_eq!(chinese_date.year().number, 4660);
assert_eq!(chinese_date.year().related_iso, Some(2023));
assert_eq!(chinese_date.year().cyclic.unwrap().get(), 40);
assert_eq!(chinese_date.month().ordinal, 6);
assert_eq!(chinese_date.day_of_month().0, 6);
Structsยง
- Chinese-based calendars define DateInner as a calendar-specific struct wrapping ChineseBasedDateInner.
- Contains any loaded precomputed data. If constructed with Default, will not contain any extra data and will always compute stuff from scratch
- Chinese
Based ๐Year Info A data struct used to load and use information for a set of ChineseBasedDates
Traitsยง
- The trait ChineseBased is used by Chinese-based calendars to perform computations shared by such calendar.
Functionsยง
- Get the ordinal lunar month from a code for chinese-based calendars.
- compute_
cache ๐Compute ChineseBasedYearInfo for a given extended year - Compute ChineseBasedYearInfo for a given extended year, for which you have already computed the YearBounds