actix_web::cookie::time::util

Function days_in_year

source
pub const fn days_in_year(year: i32) -> u16
Expand description

Get the number of calendar days in a given year.

The returned value will always be either 365 or 366.

assert_eq!(days_in_year(1900), 365);
assert_eq!(days_in_year(2000), 366);
assert_eq!(days_in_year(2004), 366);
assert_eq!(days_in_year(2005), 365);
assert_eq!(days_in_year(2100), 365);