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.valid_ordinal?

Date.valid_ordinal?(year, yday[, start=Date::ITALY]) → bool

Returns true if the given ordinal date is valid, and false if not.

Example
Date.valid_ordinal?(2001,34)      #=> true
Date.valid_ordinal?(2001,366)     #=> false

See also ::jd and ::ordinal.

See also .valid_jd? .weeknum .valid_date? ._xmlschema also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0