yup custom error message code example
Example 1: yup change error message
let schema = yup.object().shape({
foo: yup.number().typeError("Custom not a number message!")
});
Example 2: yup min validation with error message
// min and max
Yup.object().shape({
temperature: Yup.number()
.min(0, 'Min value 0.')
.max(30, 'Max value 30.'),
})
Example 3: yup custom message to type error
const schema = Yup.object().shape({
valid_since: Yup.date().typeError('Incorrect date'),
});