-
How can I control the displayed month outside the date picker context? Given the demo below, I want to change the displayed month when the user inputs a valid date and selects it (behavior is already on blur or enter keydown). The calendar should display the selected date's month... feels like it lacks a ref. Screen.Recording.2023-07-21.at.17.55.02.movIs this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@tcolinpa if I understand correctly, you want the month to be controlled by your component. In this case, you should pass the https://react-day-picker.js.org/basics/navigation#controlling-the-current-month |
Beta Was this translation helpful? Give feedback.
@tcolinpa if I understand correctly, you want the month to be controlled by your component. In this case, you should pass the
month
andonMonthChange
props, to keep the month in your component's state.https://react-day-picker.js.org/basics/navigation#controlling-the-current-month
https://codesandbox.io/s/h6pwj5?file=%2FApp.tsx