Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate end dates are after start dates #168

Open
mickzijdel opened this issue Dec 29, 2022 · 0 comments
Open

Validate end dates are after start dates #168

mickzijdel opened this issue Dec 29, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mickzijdel
Copy link
Contributor

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

@mickzijdel mickzijdel added the enhancement New feature or request label Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant