Open AkbarBakhshi opened 12 months ago
I have such a problem
Thank you for your amazing work. I am facing the same problem. However as a solution to this, I tried to re-render the component whenever a 'reset' button is clicked, it errors on "reading removeEventListner" and still couldn't've figure it out.
I managed to make it work in this solution
I added a resetCounter state that is updated whenever the "Today" button is clicked. This counter is used as a key for calendar components, forcing render
const [resetCounter, setResetCounter] = useState<number>(0);
const onHandleOption = () => {
setResetCounter((prevCounter) => prevCounter + 1);
};
<Calendar
key={`calendar1-${resetCounter}`}
value={selectedDayRange1}
onChange={setSelectedDayRange1}
shouldHighlightWeekends
locale={monthsLocale}
/>
Hello and thank you for this great library.
For the Calendar component, in the RenderFooter function, I am adding a button that will set the selected day to the current day.
If I move to another month and then click on this button, the calendar does not navigate back to the current month. The selected day will correctly change to today, but it is not visually obvious to the user if they moved to another month/year.
Is there a way to achieve that? Once "Today" is clicked, the calendar view also navigates back to the current date, if we have moved to a different month.
Thank you.