diff --git a/app/models/validations/date_validations.rb b/app/models/validations/date_validations.rb index 299146c44..c20f3af3e 100644 --- a/app/models/validations/date_validations.rb +++ b/app/models/validations/date_validations.rb @@ -36,11 +36,11 @@ module Validations::DateValidations created_at = record.created_at || Time.zone.now if created_at >= previous_collection_end_date && !record.startdate.between?(current_collection_start_date, next_collection_start_date) - record.errors.add :startdate, I18n.t("validations.date.outside_collection_window.not_crossover_period", current_collection: "#{current_collection_start_suffix}/#{current_collection_start_suffix + 1}", current_collection_start_year: current_collection_start_date.year, current_collection_end_year: current_collection_end_date.year) + record.errors.add :startdate, validation_error_message end if created_at < previous_collection_end_date && !record.startdate.between?(previous_collection_start_date, next_collection_start_date) - record.errors.add :startdate, I18n.t("validations.date.outside_collection_window.crossover_period", previous_collection: "#{previous_collection_start_suffix}/#{previous_collection_start_suffix + 1}", current_collection: "#{current_collection_start_suffix}/#{current_collection_start_suffix + 1}", previous_collection_start_year: previous_collection_start_date.year, current_collection_end_year: current_collection_end_date.year) + record.errors.add :startdate, validation_error_message end if FeatureToggle.startdate_two_week_validation_enabled? && record.startdate > Time.zone.today + 14