Jerome
Jerome

Reputation: 6179

Ruby 2.2.3 invalid date

The following method

now = Date.today
@start_week = Date.commercial(now.cwyear,now.cweek+9)

is returning and argument error invalid date. This was working under ruby 1.9.3. Oddly enough, there are no complaints regarding

@start_week = Date.commercial(now.cwyear,now.cweek+8)

and the console returns Mon, 28 Dec 2015

So the issue is how does one concisely rollover the year in such a context.

Upvotes: 0

Views: 113

Answers (1)

Jerome
Jerome

Reputation: 6179

Silly. Transform the method to a succinct

@start_week = Date.today.beginning_of_week + 9.weeks

[get percolator running]

Upvotes: 1

Related Questions