Skip to main content

Crate use_year

Crate use_year 

Source
Expand description

Primitive calendar year helpers.

These helpers keep leap-year and year-boundary calculations explicit.

§Examples

use use_year::{CalendarYear, first_day_of_year, last_day_of_year};

let year = CalendarYear::new(2024);

assert!(year.is_leap_year());
assert_eq!(year.days_in_year(), 366);
assert_eq!(first_day_of_year(2024).unwrap().month(), 1);
assert_eq!(last_day_of_year(2024).unwrap().day(), 31);

Structs§

CalendarYear

Enums§

YearError

Functions§

days_in_year
first_day_of_year
is_leap_year
last_day_of_year