Skip to main content

is_leap_year

Function is_leap_year 

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

true for Gregorian leap years (divisible by 4, except centuries not divisible by 400).

ยงExamples

use ssg::dates::is_leap_year;

assert!(is_leap_year(2024));
assert!(is_leap_year(2000)); // century divisible by 400
assert!(!is_leap_year(1900)); // century not divisible by 400
assert!(!is_leap_year(2026));