i'm trying to validate contact number in nodeJS using joi.
i seen many solution like using converting number to string we can do.
but i want to do this using only integer.
const schema = {
mo: Joi.number().length == 10,
}
thanks for your help.
You'd want something like Joi.number().integer().min(1000000000).max(9999999999). This is assuming you want mo to be an integer with a "length" of 10.
I'm not even sure I understand the question, next time try to use examples. So it's either what @arb suggested or Joi.string().length(10).
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.
Most helpful comment
You'd want something like
Joi.number().integer().min(1000000000).max(9999999999). This is assuming you wantmoto be an integer with a "length" of 10.