validatorjs / validator.js

String validation
MIT License
23.12k stars 2.31k forks source link

isDate throws when using a non-valid string with a format #2272

Closed dackmin closed 2 months ago

dackmin commented 1 year ago

Describe the bug Since v13.11.0 isDate throws when passing a non-valid string with a format. v13.9.0 works wonders.

Examples

isDate('20', { format: 'DD/MM/YYYY' })

https://runkit.com/dackmin/64e4acf5889ae3000967d281

(working example with 13.9.0 is also in there)

Additional context Validator.js version: v13.11.0 Node.js version: v18.17.1 OS platform: MacOS 13.4.1

olaleykhan commented 1 year ago

@dackmin , you are very right. I think I have found the problem. I will be raising a pull request today that should fix the issue.

pano9000 commented 2 months ago

fixed with https://github.com/validatorjs/validator.js/commit/ff56dcf5ad16abc4127528eafae559ac716863fb