Method: Date.commercial

Defined in:
lib/date.rb

.commercial(y = 1582, w = 41, d = 5, sg = ITALY) ⇒ Object

Create a new Date object for the Commercial Date specified by year y, week-of-year w, and day-of-week d.

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.

y defaults to 1582, w to 41, and d to 5, the Day of Calendar Reform for Italy and the Catholic countries.

sg specifies the Day of Calendar Reform.



773
774
775
776
777
778
# File 'lib/date.rb', line 773

def self.commercial(y=1582, w=41, d=5, sg=ITALY)
  unless jd = valid_commercial?(y, w, d, sg)
    raise ArgumentError, 'invalid date'
  end
  new!(jd_to_ajd(jd, 0, 0), 0, sg)
end