Controlled range date picker bug when clearing the dates after selecting just one #6092
Closed
1 of 2 tasks
Labels
Fixed patch
Completed issues that will be published with next patch (1.0.X)
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.8.0
What package has an issue?
@mantine/dates
What framework do you use?
create-react-app (CRA)
In which browsers you can reproduce the issue?
All
Describe the bug
Brief explanation
I have a controlled
DatePicker
withtype="range"
. In my component, I have a button for users to clear the selection they are performing. The issue is that, if a user has selected the start date and not the end date, even if you set the value to [null, null], the calendar still has the start date selected.Steps to reproduce:
Open the stackblitz url provided.
Select one date in the calendar.
Click the button to clear the dates.
Move the cursor around the calendar. You will see that the start date does not appear to be selected, but the blue shadow is still there when you hover over the calendar.
Click on another day. Now your selection will take the first date (which should have been cleared), and the second date (the one you just selected).
Minimal example used
If possible, include a link to a codesandbox with a minimal reproduction
https://stackblitz.com/edit/react-ojxzj7?file=src%2FApp.js
Possible fix
When setting the value to
[null, null]
, the dates should be cleared.Self-service
The text was updated successfully, but these errors were encountered: