Skip to content

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

class method

Date.leap?

Date.gregorian_leap?(year) → bool
Date.leap?(year) → bool

Returns true if the given year is a leap year of the proleptic Gregorian calendar.

Example
Date.gregorian_leap?(1900)        #=> false
Date.gregorian_leap?(2000)        #=> true
See also #leap? .julian_leap? .new .json_create also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0