Cookies Psst! Do you accept cookies?

We use cookies to enhance and personalise your experience.
Please accept our cookies. Checkout our Cookie Policy for more information.

yup.ref is not working inside the yup.date().min

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

https://stackoverflow.com/q/78411998/21108268

It seems like this feed has limited content. Do you want to fetch full content?

Fetch

Unfortunately, we're not able to fetch full content in this moment,
Do you want to check full content in the source blog?

View source 🔗

Last Stories

What's your thoughts?

Please Register or Login to your account to be able to submit your comment.