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

feat: reject non-calendar ISO strings #3061

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stelardn
Copy link

Fixes #2733

This adds a stricter validation to string().isoDate(), rejecting dates that do not exist in the calendar.

It does so by:

  • Validating that the day component of the ISO string matches the day derived from the corresponding JavaScript Date.
  • Handling edge cases where the difference between days is caused by T24:00 notation, in order to keep support for valid T24:00 ISO strings.
  • Preventing invalid dates such as April 31st from being accepted, even when combined with T24:00.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joi.string().isoDate() accepts iso strings that have invalid values, but have valid iso string formats
1 participant