Skip to content
Advertisement

unable to use MaterialUI Datepicker,Dayjs with useFormik and Yup

I am using Material UI Date picker with day js,but the issue that arising again and again is,’when I select the date on calender,1st time it updates in textfield and then it is not working.And also having problem in Yup like when touched 1st time it gives error means works perfectly but when removing the date from text field and left the field blank it does not work.’

codesandbox Link : https://codesandbox.io/s/material-ui-datepicker-error-pdvt07

code:

JavaScript

Thanks in advance…..

Advertisement

Answer

you need to use dayjs format when trying to display the date. the date picker already formats the date for you in the textfield.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement