react-multi-date-picker
react-multi-date-picker copied to clipboard
How to change programmatically the current displayed month in the Calendar component
Hi there.
I'm using Calendar with numberOfMonths={2} and range props for custom range selection.
I have 2 text field inputs to manually enter the start and end dates. I want to change the Calendar current month displayed to the start date month entered, but I don't see a way to do it.
I tried changing the currentDate prop, but it didn't work (I looked into the repo code later and noticed that the value is stored in a ref and is not updated afterward).
Hello @felixbores, I am also facing this same issue. Did you ever find a solution for this?
Hello @felixbores, I am also facing this same issue. Did you ever find a solution for this?
Hey
To be honest I don't remember if, in the end, I implemented a solution. But one way this can be achieved would be by using key, so that if the start date changes (month or year), the key could be updated to force the component to be recreated again. I didn't test that idea, but I think it might work.
Thanks a lot for your response. I'll try using the key.