Method: Date.weekstart
- Defined in:
- lib/vpim/date.rb
.weekstart(year, mon, day, weekstart = "MO") ⇒ Object
Return the first day of the week for the specified date. Commercial weeks start on Monday, but the weekstart can be specified (as 0-6, where 0 is sunday, or in formate of Date.str2day).
127 128 129 130 131 132 133 134 |
# File 'lib/vpim/date.rb', line 127 def Date.weekstart(year, mon, day, weekstart="MO") wkst = Date.str2wday(weekstart) d = Date.new(year, mon, day) until d.wday == wkst d = d - 1 end d end |