pub const fn create(year: u32, month: Month, day: u8) -> Result<Self, DateError> {
        if year > 9999 {
            return Err(DateError::InvalidYear(year));
        }
        if day == 0 || day > month.days_in_month(year) {
            return Err(DateError::InvalidDayForMonth(year, month, day));
        }
        let month_as_int = match month {
            Month::Jan => 1,
            Month::Feb => 2,
            Month::Mar => 3,
            Month::Apr => 4,
            Month::May => 5,
            Month::Jun => 6,
            Month::Jul => 7,
            Month::Aug => 8,
            Month::Sep => 9,
            Month::Oct => 10,
            Month::Nov => 11,
            Month::Dec => 12,
        };
        Ok(Date((year << 16) | (month_as_int << 8) | day as u32))
    }
/// Create a date based on a year, a month, and a day.
Create a date based on a year, a month, and a day.
Create a date based on a year a month and a day .
pub const fn create(year: u32, month: Month, day: u8) -> Result<Self, DateError> {
        if year > 9999 {
            return Err(DateError::InvalidYear(year));
        }
        if day == 0 || day > month.days_in_month(year) {
            return Err(DateError::InvalidDayForMonth(year, month, day));
        }
        let month_as_int = match month {
            Month::Jan => 1,
            Month::Feb => 2,
            Month::Mar => 3,
            Month::Apr => 4,
            Month::May => 5,
            Month::Jun => 6,
            Month::Jul => 7,
            Month::Aug => 8,
            Month::Sep => 9,
            Month::Oct => 10,
            Month::Nov => 11,
            Month::Dec => 12,
        };
        Ok(Date((year << 16) | (month_as_int << 8) | day as u32))
    }
pub const fn create ( year : u32 , month : Month , day : u8 ) -> Result < Self , DateError > { if year > 9999 { return Err ( DateError :: InvalidYear ( year ) ) ; } if day == 0 || day > month . days_in_month ( year ) { return Err ( DateError :: InvalidDayForMonth ( year , month , day ) ) ; } let month_as_int = match month { Month :: Jan => 1 , Month :: Feb => 2 , Month :: Mar => 3 , Month :: Apr => 4 , Month :: May => 5 , Month :: Jun => 6 , Month :: Jul => 7 , Month :: Aug => 8 , Month :: Sep => 9 , Month :: Oct => 10 , Month :: Nov => 11 , Month :: Dec => 12 , } ; Ok ( Date ( ( year << 16 ) | ( month_as_int << 8 ) | day as u32 ) ) }
Create a date based on a year, a month, and a day.
Create a date based on a year a month and a day .
year
u32
month
Month
day
u8
year
u32
month
Month
day
u8