Skip to content

Commit

Permalink
Add extra day to case contact date validation (#6047)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thejonroberts committed Sep 25, 2024
1 parent 54064b6 commit 0c5ba75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/case_contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0c5ba75

Please sign in to comment.