_valid_civil?(y, m, d, sg=GREGORIAN)public
m and d can be negative, in which case they count backwards from the end of the year and the end of the month respectively. No wraparound is performed, however, and invalid values cause an ArgumentError to be raised. 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 614 def _valid_civil? (y, m, d, sg=GREGORIAN) # :nodoc: if m < 0 m += 13 end if d < 0 j = find_ldom(y, m, sg) ny, nm, nd = jd_to_civil(j + d + 1, sg) return unless [ny, nm] == [y, m] d = nd end jd = civil_to_jd(y, m, d, sg) return unless [y, m, d] == jd_to_civil(jd, sg) jd end