here's my code, i'm trying to force the two date fields always to be different, the end date must be at least 1 day after the start date.
const EditSchema = Yup.object().shape({
StartDate: Yup.date()
.transform(value => (isDate(value) ? undefined : value))
.typeError('Enter a start date')
.required('Enter a start date'),
EndDate: Yup.date()
.min(Yup.ref('StartDate'), 'End date must be after start date')
.transform(value => (isDate(value) ? undefined : value))
.typeError('Enter an end date')
.required('Enter an end date')
});