Class: Renalware::Admin::PlaygroundsController::ChartForm

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, Virtus::Model
Defined in:
app/controllers/renalware/admin/playgrounds_controller.rb

Instance Method Summary collapse

Instance Method Details

#start_dateObject

Map a period string to a date, eg 6m = 6 months ago



27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/renalware/admin/playgrounds_controller.rb', line 27

def start_date
  time = case period
         when "yr" then 1.year.ago
         when "6m" then 6.months.ago
         when "3m" then 3.months.ago
         when "1m" then 1.month.ago
         when "1wk" then 1.week.ago
         else 100.years.ago
         end
  time.to_date.to_s
end