Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Date.leap?

(::Integer year) -> bool
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

Related: Date.julian_leap?.

See also #leap? .julian_leap? .new .json_create also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0