time_core::util

Function is_leap_year

Source
pub const fn is_leap_year(year: i32) -> bool
Expand description

Returns if the provided year is a leap year in the proleptic Gregorian calendar. Uses astronomical year numbering.

assert!(!is_leap_year(1900));
assert!(is_leap_year(2000));
assert!(is_leap_year(2004));
assert!(!is_leap_year(2005));
assert!(!is_leap_year(2100));