pub fn new(y: u16, m: u8, d: u8) -> Result<DateTuple, String> {
        if y > 9999 {
            return Err(format!(
                "Invalid year in DateTuple {:?}: year must be <= 9999.",
                DateTuple { y, m, d }
            ));
        }
        if (1..=12).contains(&m) {
            if d == 0 || d > date_utils::get_last_date_in_month(m, y) {
                return Err(format!(
                    "Invalid date in DateTuple: {:?}",
                    DateTuple { y, m, d }
                ));
            }
            Ok(DateTuple { y, m, d })
        } else {
            Err(format!(
                "Invalid month in DateTuple: {:?}\nMonth must be between 1 and 12; Note that months are ONE-BASED since version 2.0.0.",
                DateTuple { y, m, d }
            ))
        }
    }
/// Takes a year, month, and day and converts them into a DateTuple.
///
/// Will not overlap - the date entered must be valid without further calculation.
Takes a year, month, and day and converts them into a DateTuple.
Will not overlap - the date entered must be valid without further calculation.
Takes a year month and day and converts them into a DateTuple . Will not overlap - the date entered must be valid without further calculation .
pub fn new(y: u16, m: u8, d: u8) -> Result<DateTuple, String> {
        if y > 9999 {
            return Err(format!(
                "Invalid year in DateTuple {:?}: year must be <= 9999.",
                DateTuple { y, m, d }
            ));
        }
        if (1..=12).contains(&m) {
            if d == 0 || d > date_utils::get_last_date_in_month(m, y) {
                return Err(format!(
                    "Invalid date in DateTuple: {:?}",
                    DateTuple { y, m, d }
                ));
            }
            Ok(DateTuple { y, m, d })
        } else {
            Err(format!(
                "Invalid month in DateTuple: {:?}\nMonth must be between 1 and 12; Note that months are ONE-BASED since version 2.0.0.",
                DateTuple { y, m, d }
            ))
        }
    }
pub fn new ( y : u16 , m : u8 , d : u8 ) -> Result < DateTuple , String > { if y > 9999 { return Err ( format ! ( " " DateTuple { y m d } ) ) ; } if ( 1 ..= 12 ) . contains ( & m ) { if d == 0 || d > date_utils :: get_last_date_in_month ( m , y ) { return Err ( format ! ( " " DateTuple { y m d } ) ) ; } Ok ( DateTuple { y , m , d } ) } else { Err ( format ! ( " \n " DateTuple { y m d } ) ) } }
Takes a year, month, and day and converts them into a DateTuple.
Takes a year month and day and converts them into a DateTuple .
y
u16
m
u8
d
u8
y
u16
m
u8
d
u8