Browse Source

Update app/controllers/form_controller.rb

Co-authored-by: James Rose <james@jbpr.net>
pull/830/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
f7db0966e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/controllers/form_controller.rb

2
app/controllers/form_controller.rb

@ -89,7 +89,7 @@ private
year = params["case_log"]["#{question.id}(1i)"]
next unless [day, month, year].any?(&:present?)
result[question.id] = if day.to_i.between?(1, 31) && month.to_i.between?(1, 12) && year.to_i.between?(2000, 2200) && Time.days_in_month(month.to_i, year.to_i) >= day.to_i
result[question.id] = if Date.valid_date?(year.to_i, month.to_i, day.to_i) && year.to_i.between?(2000, 2200)
Date.new(year.to_i, month.to_i, day.to_i)
else
Date.new(0, 1, 1)

Loading…
Cancel
Save