开发者

Date Validation end date must be greater or equal than start date using Yup

Hi I want to validate date in react using Yup I want that the end date should be equal or greater than the start date

This what I have did but its not working for the equal da开发者_C百科tes

const validationSchema = Yup.object().shape({
 
  startDate: Yup.date().required('Please select start date'),
  endDate: Yup.date().min(
    Yup.ref('startDate'),
    "end date can't be before start date"
  ),
  
});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜