lib/modules/date_utilities.rb
# returns Mon-Sun week that includes date
returns Mon-Sun week that includes date
returns Mon - Sun week that includes date
def date_to_week(date)
    date = Date.parse(date.to_s)
    date_day = date.strftime('%u').to_i
    day_diff = date_day - 1
    week_start = (day_diff > 0) ? date - day_diff : date
    week_end = week_start + 6
    [week_start.strftime('%Y-%m-%d'), week_end.strftime('%Y-%m-%d')]
  end
def date_to_week ( date ) date = Date . parse ( date . to_s ) date_day = date . strftime ( '%u' ) . to_i day_diff = date_day - 1 week_start = ( day_diff > 0 ) ? date - day_diff : date week_end = week_start + 6 [ week_start . strftime ( '%Y-%m-%d' ) , week_end . strftime ( '%Y-%m-%d' ) ] end
returns Mon-Sun week that includes date
returns Mon - Sun week that includes date
date
<not_specific>