I have been trying everything to make this form work with yup, but when using the date-picker, the value doesn't register either within the field or with yup. My relevant imports are formik, yup, useForm and yupResolver.
I have removed non-relevant code to save space. The other fields i have are first name, last name, email and phone number, and they all work as they should, with values registering and errors showing up when they don't fill the criteria.
I have a console log withing the formik element which logs all the values, and all the values get logged properly except the dates, which stand empty.
const Form = () => {
const [fromDate, setFromDate] = useState(new Date());
return (
<>
<div>
<Formik validationSchema={formVal}>
{({ values,
errors) => (
<form onSubmit={handleSubmit(onSubmit)}>
<div>
<DatePicker
id="fromDate"
onChange={(date) => {
setFieldValue(date);
}}
/>
</div>
<Button type="submit" ></Button>
</form>
)}
</Formik>
</div>
</>
)}