I want the user to input his date of birth. And I would want it be in format YYYY-MM-DD. Node-Validator right now validates all date format, not a particular format. So If I input 12324433 , it is also validated as it thinks its epoch time.
Please help me out as to what should I do? This question is specific to validation in Mongoose
I'm a big fan of express-form
, def worth a look -- you can also use moment.js
. I've used it myself a for this very reason
from moment.js docs:
moment("2011-10-10", "YYYY-MM-DD").isValid(); // true
moment("2011-10-50", "YYYY-MM-DD").isValid(); // false (bad day of month)
Cheers, I hope this helps :)
ps - moment.js github url just in case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With