Skip to content

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

class method

Date.valid_ordinal?

(::Integer year, ::Integer yday, ?::Integer start) -> bool
Date.valid_ordinal?(year, yday, start = Date::ITALY) → true or false

Returns true if the arguments define a valid ordinal date, false otherwise:

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

See argument start.

Related: Date.jd, Date.ordinal.

See also .valid_jd? ._xmlschema .valid_date? .xmlschema also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0