Skip to content

Instantly share code, notes, and snippets.

@azuby
Created February 10, 2012 04:09
Show Gist options
  • Save azuby/1786515 to your computer and use it in GitHub Desktop.
Save azuby/1786515 to your computer and use it in GitHub Desktop.
begin
params[:from] ||= "rubbish"
start_date = params[:from].to_datetime
rescue ArgumentError
start_date = 1.week.ago
params[:from] = start_date.strftime("%m/%d/%Y")
end
begin
params[:to] ||= "rubbish"
end_date = params[:to].to_datetime
rescue ArgumentError
end_date = 1.week.ago
params[:to] = end_date.strftime("%m/%d/%Y")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment