#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
pub(crate) mod error;
pub(crate) mod helpers;
pub(crate) mod impls;
pub use error::IntDateError;
use helpers::*;
use std::convert::TryInto;
use std::str::FromStr;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct IntDate(u32);
impl IntDate {
pub fn raw(&self) -> u32 {
self.0
}
pub fn get_day(&self) -> u8 {
get_day_part(self.0)
}
pub fn get_month(&self) -> u8 {
get_month_part(self.0)
}
pub fn get_year(&self) -> u32 {
get_year_part(self.0)
}
pub fn is_year_leap(&self) -> bool {
is_year_leap(self.0)
}
}
pub fn from_u32(input: u32) -> Result<IntDate, IntDateError> {
input.try_into()
}
pub fn from_str<T: AsRef<str>>(input: T) -> Result<IntDate, IntDateError> {
let input = input.as_ref();
IntDate::from_str(input)
}