Closed david-unergie closed 4 years ago
Usually, I use this kind of "alias" in conjuction of the ".raw()" behavior.
A surprising thing, .allow()
works fine with null
and ''
:
const joi = require('joi').extend(require('joi-date-extensions'))
joi.date().format('YYYY-MM-DD').allow('').validate('') // => works fine
joi.date().format('YYYY-MM-DD').allow(null).validate(null) // => works fine
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Context
What are you trying to achieve or the steps to reproduce ?
The whitelisting behavior ".allow" seems not working since Joi.date().format() is in an external module.
Working with joi v9.2.0:
Failing with v10.6.0 / v11.4.0 / v12.0.0 / v13.7.0 / v14.3.0:
Which result you had ?
"value" must be a string with one of the following formats [YYYY-MM-DD]
What did you expect ?
No error