From f7db0966e5665bef3a36aa88751b799925a30514 Mon Sep 17 00:00:00 2001 From: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Date: Fri, 12 Aug 2022 13:16:40 +0100 Subject: [PATCH] Update app/controllers/form_controller.rb Co-authored-by: James Rose --- app/controllers/form_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 954554e4a..52e3bc3a7 100644 --- a/app/controllers/form_controller.rb +++ b/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)