Calendar does not react to a change of value if lands in prev/next month
See original GitHub issue🐛 Bug Report
When programmatically changing the value for DatePicker (or DateRangePicker), if the day/range lands in the previous month, the UI does not show the correct selected month.
🤔 Expected Behavior
The UI should update to show the picked day/range when value updates.
😯 Current Behavior
Month does not switch. See Codesandbox example
🔦 Context
We need the UI to update correctly. While the DatePicker assumes that the popover will be closed when choosing a new value, this is not true for our use case.
💻 Code Sample
🌍 Your Environment
| Software | Version(s) |
|---|---|
| react-spectrum | 3.20.0 |
| Browser | Chrome 104.0.5112.79 |
| Operating System | OSX Monterey |
🧢 Your Company/Team
Mastery Logistics Systems
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
calendar don't update view when value change to other month
When I change value of date in current month calendar update view. But when value in new month, calendar still show current month....
Read more >React-calendar Ui not switching when value is set from ...
The UI of the react calendar is not switching to the respective month when the value is set functionally after the calendar has...
Read more >Flexipass | City of Vancouver
A Flexipass gives you access to fitness centres, indoor pools, and ice rinks throughout the city. You can purchase your monthly Flexipass for...
Read more >Untitled
The Greg Gutfeld Show does not have an online form because the studio is very small. Greg Gutfeld Concert Schedule Nov 19, 2022...
Read more >Calendar.PrevMonthText Property - Microsoft Learn
This property does not automatically encode to HTML. You need to convert special characters to the appropriate HTML value, unless you want the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We can take a look at supporting this in DatePicker but if you are using the aria hooks to create your own DatePicker you can try using the
focusedValueprop in useCalendar fix this behavior.Thanks for the extra context! That isn’t something that spectrum currently defines. So it may be that you need to implement some extra things as a result/you may find other cases we don’t support. Still odd our calendar doesn’t update, that seems like a bug at least. I’ll bring it up to our team.