_valid_commercial?(y, w, d, sg=GREGORIAN)public
Monday is day-of-week 1; Sunday is day-of-week 7.
w and d can be negative, in which case they count backwards from the end of the year and the end of the week 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 643 def _valid_commercial? (y, w, d, sg=GREGORIAN) # :nodoc: if d < 0 d += 8 end if w < 0 ny, nw, nd = jd_to_commercial(commercial_to_jd(y + 1, 1, 1, sg) + w * 7, sg) return unless ny == y w = nw end jd = commercial_to_jd(y, w, d, sg) return unless [y, w, d] == jd_to_commercial(jd, sg) jd end