|
|
|
@ -447,14 +447,12 @@ class Location < ApplicationRecord |
|
|
|
elsif reactivation_date_type == "other" |
|
|
|
elsif reactivation_date_type == "other" |
|
|
|
errors.add(:reactivation_date, message: I18n.t("validations.location.toggle_date.invalid")) |
|
|
|
errors.add(:reactivation_date, message: I18n.t("validations.location.toggle_date.invalid")) |
|
|
|
end |
|
|
|
end |
|
|
|
else |
|
|
|
elsif !reactivation_date.between?(available_from, Time.zone.local(2200, 1, 1)) |
|
|
|
if !reactivation_date.between?(available_from, Time.zone.local(2200, 1, 1)) |
|
|
|
|
|
|
|
errors.add(:reactivation_date, message: I18n.t("validations.location.toggle_date.out_of_range", date: available_from.to_formatted_s(:govuk_date))) |
|
|
|
errors.add(:reactivation_date, message: I18n.t("validations.location.toggle_date.out_of_range", date: available_from.to_formatted_s(:govuk_date))) |
|
|
|
elsif reactivation_date < recent_deactivation.deactivation_date |
|
|
|
elsif reactivation_date < recent_deactivation.deactivation_date |
|
|
|
errors.add(:reactivation_date, message: I18n.t("validations.location.reactivation.before_deactivation", date: recent_deactivation.deactivation_date.to_formatted_s(:govuk_date))) |
|
|
|
errors.add(:reactivation_date, message: I18n.t("validations.location.reactivation.before_deactivation", date: recent_deactivation.deactivation_date.to_formatted_s(:govuk_date))) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
|