yup number validation custom message
numberFiled: Yup.number()
.typeError('you must specify a number')
.min(0, 'Min value 0.')
.max(30, 'Max value 30.')
yup number validation custom message
numberFiled: Yup.number()
.typeError('you must specify a number')
.min(0, 'Min value 0.')
.max(30, 'Max value 30.')
phone number validation in yup
Yup.object({
phone: Yup.string()
.required("This field is Required")
.matches(
/^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/,
"Phone number is not valid"
)
})
yup phone number
const phoneRegExp = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/
phoneNumber: Yup.string().matches(phoneRegExp, 'Phone number is not valid')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us