logo
pub const fn weeks_in_year(year: i32) -> u8
Expand description

Get the number of weeks in the ISO year.

The returned value will always be either 52 or 53.

assert_eq!(weeks_in_year(2019), 52);
assert_eq!(weeks_in_year(2020), 53);

This function is const fn when using rustc >= 1.46.