EdinburghUniversityTheatreCompany / black_lightning

MIT License
3 stars 4 forks source link

Validate end dates are after start dates #168

Open mickzijdel opened 1 year ago

mickzijdel commented 1 year ago

Date validations are not built in. Maybe a gem, or a concern like this:

def ensure_start_date_before_end_date
  return unless start_date.present? && end_date.present?
  return if start_date < end_date

  errors.add(:base, :start_date_after_end_date)
end

Credits to Hayden Ball for that -> https://bitbucket.org/bedlamtheatre/black_lightning/issues/179/validate-end-dates-are-after-start-dates