Files
grecia/app/controllers/concerns/dashboard/expects_date_range.rb
Javi Martín a21240b230 Use Date.current and Time.current
Using Date.today and Time.now might lead to inconsistencies if the time
zone the application uses is not the same as the system time zone.
2019-08-28 20:32:40 +02:00

16 lines
381 B
Ruby

module Dashboard::ExpectsDateRange
extend ActiveSupport::Concern
include Dashboard::HasProposal
def start_date(fallback_date = proposal.created_at.to_date)
return Date.parse(params[:start_date]) unless params[:start_date].blank?
fallback_date
end
def end_date
return Date.parse(params[:end_date]) unless params[:end_date].blank?
Date.current
end
end