Module: ScheduleFu::ScheduleFuHelper

Defined in:
lib/schedule_fu/schedule_fu_helper.rb

Instance Method Summary collapse

Instance Method Details

#parse_date_or_now(date) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/schedule_fu/schedule_fu_helper.rb', line 9

def parse_date_or_now(date)
  begin
    Date.parse(date)
  rescue
    Time.now.to_date
  end
end

#previous_sunday(date) ⇒ Object



4
5
6
7
# File 'lib/schedule_fu/schedule_fu_helper.rb', line 4

def previous_sunday(date)
  date = parse_date_or_now(date)
  date.wday.ago date
end