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

Typescript issue with .isAfter() #662

Closed
Jujunol opened this issue May 16, 2017 · 2 comments
Closed

Typescript issue with .isAfter() #662

Jujunol opened this issue May 16, 2017 · 2 comments

Comments

@Jujunol
Copy link

Jujunol commented May 16, 2017

The typescript definition file shows that .isAfter() takes a Date as an argument but it seems that it really wants a string. After passing it a date using the following:

req.assert('start_date', "Please select a valid start date").optional().isDate().isAfter(unixToDate(minTimestamp));

I get the following error:

TypeError: This library (validator.js) validates strings only
    at assertString (*/node_modules/express-validator/node_modules/validator/lib/util/assertString.js:9:11)
    at toDate (*/node_modules/express-validator/node_modules/validator/lib/toDate.js:15:30)
    at Object.isAfter (*/node_modules/express-validator/node_modules/validator/lib/isAfter.js:22:41)
    at Object.validator.(anonymous function) [as isAfter] (*/node_modules/express-validator/lib/express_validator.js:13:15)
    at ValidatorChain.isAfter (*/node_modules/express-validator/lib/express_validator.js:469:41)
@hkwu
Copy link
Contributor

hkwu commented May 24, 2017

I think you're looking at the wrong repo? There aren't any TypeScript definitions included in this package.

@Jujunol
Copy link
Author

Jujunol commented May 24, 2017

Looking at the issue having req.assert I'm presuming that this was meant for express-validator.

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

No branches or pull requests

2 participants