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 ๐Date Inner - Chinese-based calendars define DateInner as a calendar-specific struct wrapping ChineseBasedDateInner.
- Chinese
Based ๐Precomputed Data - 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ยง
- Chinese
Based ๐With Data Loading - The trait ChineseBased is used by Chinese-based calendars to perform computations shared by such calendar.
Functionsยง
- chinese_
based_ ๐ordinal_ lunar_ month_ from_ code - Get the ordinal lunar month from a code for chinese-based calendars.
- compute_
cache ๐ - Compute ChineseBasedYearInfo for a given extended year
- compute_
cache_ ๐with_ yb - Compute ChineseBasedYearInfo for a given extended year, for which you have already computed the YearBounds
- compute_
packed_ ๐with_ yb