I want to validate input strings which are in mysql datetime format like this:
YYYY-MM-DD HH:mm:ss
2018-10-12 19:32:55
How can I do that?
I have used this code but it allows strings like 222018-10-12 19:32:55 which are invalid.
created_at: Joi.date().required()
As of version v10 joi.format()
was removed and instead you can use joi-date-extensions
which provides validation helpers like this:
Joi.date().format('YYYY-MM-DD');
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