-
Notifications
You must be signed in to change notification settings - Fork 806
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
fix: option is not passed to validator in @IsDateString
decorator
#1061
Comments
Same issue here. Seems to be an issue with const validator = require('validator');
validator.isISO8601('2009-02-29', {strict: true}); |
Ok, found the bug here. Unlike IsISO8601, Line 27 should be changed to the following in validate: (value, args): boolean => isDateString(value, args.constraints[0]) Current workaround would be to use @NoNameProvided do you want me to create a new PR or can you just fix this? |
`@IsDateString({strict: true})` doesn't work because options are not passed to the validator. Fixes typestack#1061
PR #1097 |
Related: validatorjs/validator.js#2003 |
Merged in #1720. |
@IsDateString
decorator
This feature/fix has been released in |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
According to the type docs, when using
IsDateString({ strict: true})
:"If
strict
istrue
, performs additional checks for valid dates, e.g. invalidates dates like2009-02-29
". But those dates appear to be passing the validation in my appMinimal code-snippet showcasing the problem
So I created a repo for bug reproduction here. In essence:
Expected behavior
According to the docs, a date as "2009-02-29" should fail when using isoDate validation with strict = true; (taken directly from the docs)
Actual behavior
The validator passes
Version
class-validator: 0.13.1
node: 14
The text was updated successfully, but these errors were encountered: