Open ningji opened 10 months ago
More info, i put some console.log at isDate@lib/isDate.js, isData("2020-06-15") was working on 13.7,
now for 13.11 the argument input is "2020-06-15", options is undefined
More dbg info, the issue is from lib/isDate.js around line 120. return new Date("".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d)).getDate() === +dateObj.d;
in my test, the input is "2020-06-15", "".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d) is "2020-06-15T00:00:00.000Z".
but its getDate() returns 14 not 15.
I don't know how to fix it.
Ppl in stackoverflow mentioned it works fine in linux and win11.
Might be this one https://github.com/validatorjs/validator.js/issues/2256
Describe the bug isDate("2020-06-15") is failing on 13.11.0, which is called from express-validator. it used to work on 13.7.0.
const validator = require('validator'); const rt = validator.isDate('2022-06-15'); console.log(rt);
it prints false
Examples isData("2020-06-15") was working on 13.7.0
I realized there's a change on 13.11.0 https://github.com/validatorjs/validator.js/pull/2231 and changed my code to isDate("2012-03-29T10:05:45-06:00") but still fails.
doesn't like "2012-03-29T10:05:45.000Z" either.
this format is from the online search on ISO 8601 date format https://www.digi.com/resources/documentation/digidocs/90001488-13/reference/r_iso_8601_date_format.htm
My question is, what's the good example to pass isDate() ? thanks !
Additional context Validator.js version: 13.11.0 Node.js version: 16.16.0 OS platform: macOS