diff --git a/app/models/validations/date_validations.rb b/app/models/validations/date_validations.rb index 18267ffdb..eeaf8e674 100644 --- a/app/models/validations/date_validations.rb +++ b/app/models/validations/date_validations.rb @@ -51,6 +51,14 @@ module Validations::DateValidations record.errors.add :startdate, I18n.t("validations.setup.startdate.before_scheme_end_date") end end + + if record["voiddate"].present? && (record.startdate < record["voiddate"]) + record.errors.add :startdate, I18n.t("validations.setup.startdate.after_void_date") + end + + if record["mrcdate"].present? && (record.startdate < record["mrcdate"]) + record.errors.add :startdate, I18n.t("validations.setup.startdate.after_major_repair_date") + end end private diff --git a/config/locales/en.yml b/config/locales/en.yml index ef58f0cae..8b9a12286 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -118,6 +118,8 @@ en: startdate: later_than_14_days_after: "The tenancy start date must not be later than 14 days from today’s date" before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme" + after_void_date: "Enter a tenancy start date that is after the void date" + after_major_repair_date: "Enter a tenancy start date that is after the major repair date" property: mrcdate: