valid_commercial?(y, w, d, sg=ITALY)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 654 def self.valid_commercial? (y, w, d, sg=ITALY) if d < 0 d += 8 end if w < 0 ny, nw, nd = jd_to_commercial(commercial_to_jd(y + 1, 1, 1) + w * 7) return unless ny == y w = nw end jd = commercial_to_jd(y, w, d) return unless gregorian?(jd, sg) return unless [y, w, d] == jd_to_commercial(jd) jd end