I have a basic requirement of end date should be greater than start date. I'm using yup schema for error handling for my react application.
const validateSchema = Yup.object().shape({
startDate: Yup.date()
.default(() => new Date())
.typeError("Please Enter valid Date Format")
.required("Field is Mandatory"),
endDate: Yup.date()
.default(() => new Date())
.typeError("Please Enter valid Date Format")
.required("Field is Mandatory")
.min(Yup.ref("startDate"), "Minimum Date"),
});
sandbbox link: Sandbox link
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)