From 0c5ba75e987059ce562bf09a41024eb60cb4d19c Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Tue, 24 Sep 2024 20:03:39 -0400 Subject: [PATCH] Add extra day to case contact date validation (#6047) Addresses (temporarily?) issue where validation failed when user selected current day in browser. Date could be wrong for those situations, however. Also uses Time.zone.tomorrow vs Date.tomorrow --- app/models/case_contact.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/case_contact.rb b/app/models/case_contact.rb index 7a8451074b..81dd4abda2 100644 --- a/app/models/case_contact.rb +++ b/app/models/case_contact.rb @@ -15,8 +15,9 @@ class CaseContact < ApplicationRecord message: "can't be prior to #{I18n.l(MINIMUM_DATE)}.", allow_nil: true } + # NOTE: 'extra' day is a temporary fix for user selecting current date, but this validation failing validates :occurred_at, comparison: { - less_than: Date.tomorrow, + less_than: Time.zone.tomorrow + 1.day, message: :cant_be_future, allow_nil: true }