mantine icon indicating copy to clipboard operation
mantine copied to clipboard

Date Range Picker not showing errors when validated using @mantine/forms and the zodResolver

Open SamKingDev opened this issue 2 years ago • 0 comments

What package has an issue

@mantine/dates

Describe the bug

When you validate the date range picker with zod validator and arrays it returns two errors:

{
   "date.0":"Expected date, received null",
   "date.1":"Expected date, received null"
}

However I believe that the DateRangePicker is expecting an issue for "date" and not either "date.0" or "date.1".

When you add a manual error with form.setFieldError it works correctly.

However this is just a guess as I haven't had a chance to test further unfortunately.

What version of @mantine/hooks page do you have in package.json?

5.10.3

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/relaxed-pateu-up9yoi?file=/src/App.tsx

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

No response

SamKingDev avatar Feb 06 '23 13:02 SamKingDev