Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Date.gregorian_leap?

Date.gregorian_leap?(year) → true or false

Returns true if the given year is a leap year in the proleptic Gregorian calendar, false otherwise:

Example
Date.gregorian_leap?(2000) # => true
Date.gregorian_leap?(2001) # => false

Date.leap? is an alias for Date.gregorian_leap?.

Related: Date.julian_leap?.

See also .commercial ._httpdate .civil .httpdate also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0