Closed tuantvu closed 7 months ago
I stumbled upon a workaround. I don't know why, but when I extracted the DatePickerDialog into a private component, the DatePickerInput and DatePickerDialog stays in sync. Using the DatePickerDialog or wrapping it with one layer of Box doesn't work. See example below.
const MyComponent = () => {
// private component
const Dialog = () => (
<DatePickerDialog>
<DatePickerCalendar />
</DatePickerDialog>
)
return (
<DatePicker
placement="bottom"
granularity="day"
>
<DatePickerInput />
{/* WORKS*/}
<Dialog />
{/* DOES NOT WORK
<DatePickerDialog>
<DatePickerCalendar />
</DatePickerDialog>
*/}
{/* ALSO DOES NOT WORK
<Box>
<DatePickerDialog>
<DatePickerCalendar />
</DatePickerDialog>
</Box> */}
</DatePicker>
)
}
Interesting that this fixes it, thanks for the info. I'm going to investigate this now.
The value is actually in sync, but the calendar doesn't open on the correct month.
@tuantvu it seems like a limitation of react aria calendar. Found a fix, will release it later this week.
This was released in 0.12.23
Description
When using the DateInput or DatePickerInput with a DatePickerDialog, on change of the DateInput or DatePickerInput does not update the value in the DatePickerDialog. This can be recreate-able in the Saas-UI live demo. Consistently keeping the values in sync between the two components feels more user friendly.
Link to Reproduction
https://saas-ui.dev/docs/components/date-time/date-input
Steps to reproduce
Saas UI Version
0.31.1
Chakra UI Version
2.2.0
Browser
Chrome 121.0.6167.184
Operating System
Additional Information