_valid_ordinal?(y, d, sg=GREGORIAN)public
d can be a negative number, in which case it counts backwards from the end of the year (-1 being the last day of the year). No year wraparound is performed, however, so valid values of d are -365 .. -1, 1 .. 365 on a non-leap-year, -366 .. -1, 1 .. 366 on a leap year. A date falling in the period skipped in the Day of Calendar Reform adjustment is not valid.
sg specifies the Day of Calendar Reform.
# File lib/date.rb, line 590 def _valid_ordinal? (y, d, sg=GREGORIAN) # :nodoc: if d < 0 j = find_ldoy(y, sg) ny, nd = jd_to_ordinal(j + d + 1, sg) return unless ny == y d = nd end jd = ordinal_to_jd(y, d, sg) return unless [y, d] == jd_to_ordinal(jd, sg) jd end