Skip to main content

lunar_lite/
date.rs

1/// A date in the Gregorian (solar) calendar.
2#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
4pub struct SolarDate {
5    /// Proleptic Gregorian year (may be negative).
6    pub year: i32,
7    /// Month of the year, `1..=12`.
8    pub month: u8,
9    /// Day of the month, `1..=31` depending on month and year.
10    pub day: u8,
11}
12
13/// A date in the Chinese lunar calendar.
14#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
16pub struct LunarDate {
17    /// Lunar year.
18    pub year: i32,
19    /// Lunar month, `1..=12`.
20    pub month: u8,
21    /// Day of the lunar month, `1..=30`.
22    pub day: u8,
23    /// Whether this is the leap (intercalary) instance of `month`.
24    pub is_leap_month: bool,
25}