You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Joi from 'joi';
import joiPhoneNumber from 'joi-phone-number';
const customJoi = Joi.extend(joiPhoneNumber);
const joiresponse = customJoi.string().phoneNumber({ defaultCountry: 'US', format: 'e164', strict: true }).validate('+11111111111').messages({
'value.invalid':
'Please enter a valid phone number',
});
console.log(joiresponse);
I get the following error
customJoi.string(...).phoneNumber(...).validate(...).messages is not a function","stack":"TypeError: customJoi.string(...).phoneNumber(...).validate(...).messages is not a function
Is there a way to add our own custom message for validation error? Currently the message I receive says
"value" did not seem to be a phone number"
The text was updated successfully, but these errors were encountered:
Code:
I get the following error
Is there a way to add our own custom message for validation error? Currently the message I receive says
The text was updated successfully, but these errors were encountered: