Closed creix closed 1 year ago
This is because you are setting the initial dates to "". This is not a valid value. Set them to null and the issue is resolved.
This is because you are setting the initial dates to "". This is not a valid value. Set them to null and the issue is resolved.
Actually the error still remains even with setting initial dates to null.
@creix You can use validateOnBlur={true} as a workaround and I see it's a better UX.
@creix You can use validateOnBlur={true} as a workaround and I see it's a better UX.
I agree with you. My choice was based on the fact that i have a test with an async call to my server so i didn't wanted to send too many requests to the server.
I'd suggest to keep client validation in validationSchema, and handle server validation with formik.setFieldError. Something like sentRequest(formValues).then(...).catch(err=> setFieldError('field', err)
Bug report
Current Behavior
When field with DateTimePicker is visited it fires the validation of the entire form, even if i have set
validateOnChange={false}
andvalidateOnBlur={false}
for Formik.screencast-codesandbox.io-2023.02.13-14_14_39.webm
Expected behavior
The validation don't fire when visiting DatePickers
Reproducible example
https://codesandbox.io/s/laughing-burnell-4wh8s2?file=/src/App.js
Your environment