pub struct GregorianDate { /* private fields */ }Expand description
Gregorian Calendar date (proleptic).
The implementation for the Gregorian Calendar is very slim
and intentionally doesn’t have a dedicated month type or support weekdays.
It’s only here to allow conversions from the Gregorian Calendar to SAC13 and vice-versa.
If you want better typing for the Gregorian Calender check out the crates chrono and time.
Implementations§
Source§impl GregorianDate
impl GregorianDate
Sourcepub const MIN: Self
pub const MIN: Self
Earliest representable date: -10’000-03-22
Corresponds to A000-01-01 in SAC13. We only allow GregorianDates that have a corresponding SAC13 date to simplify the API.
Sourcepub const MAX: Self
pub const MAX: Self
Latest representable date: 16’000-03-17
Corresponds to Z999-13-29 in SAC13. We only allow GregorianDates that have a corresponding SAC13 date to simplify the API.
Sourcepub const fn from_ymd(year: i16, month: u8, day: u8) -> Option<Self>
pub const fn from_ymd(year: i16, month: u8, day: u8) -> Option<Self>
Creates a Gregorian Calendar date from its components year, month and day.
Returns None if the given date is invalid (doesn’t exist in the Gregorian Calendar),
like day zero or August 32th, or February 29th on non-leap (common) years.
It also returns None if the date is outside the supported SAC13 range
(see GregorianDate::MIN and GregorianDate::MAX).
pub const fn is_leap_year(year: i16) -> bool
pub const fn month_len(year: i16, month: u8) -> Option<u8>
pub const fn year(&self) -> i16
pub const fn month(&self) -> u8
pub const fn day(&self) -> u8
Trait Implementations§
Source§impl CalendarDate for GregorianDate
impl CalendarDate for GregorianDate
Source§impl Clone for GregorianDate
impl Clone for GregorianDate
Source§fn clone(&self) -> GregorianDate
fn clone(&self) -> GregorianDate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more