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.
16 lines
381 B
Ruby
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
|