#Date Range Picker - Invalid Date when User opens and closes Calendar without picking date despite

2 messages · Page 1 of 1 (latest)

safe crescent
#

Hello, I have a form that uses a date range picker. When a user opens and closes the calendar without picking a date, and the form submits, with that field technically "empty", the values that are passed along to submit are "invalid date" I was wondering how to overcome this. The form is considered required so I'm not sure how this could be possible....

meager patrol
# safe crescent Hello, I have a form that uses a date range picker. When a user opens and closes...

if you want to force the form to require two valid dates you can add a validate function

for example, checking if some date is null:
https://codesandbox.io/s/suspicious-rhodes-nfpe3r?file=/src/App.tsx

suspicious-rhodes-nfpe3r by mpyoo using @emotion/react, @mantine/carousel, @mantine/core, @mantine/dates, @mantine/form, @mantine/hooks, @mantine/modals, @mantine/notifications, @mantine/prism