react-multi-date-picker icon indicating copy to clipboard operation
react-multi-date-picker copied to clipboard

How to change programmatically the current displayed month in the Calendar component

Open felixbores opened this issue 1 year ago • 3 comments

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).

felixbores avatar Nov 15 '23 20:11 felixbores

Hello @felixbores, I am also facing this same issue. Did you ever find a solution for this?

abhishekram404 avatar Apr 05 '24 11:04 abhishekram404

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.

felixbores avatar Apr 05 '24 13:04 felixbores

Thanks a lot for your response. I'll try using the key.

abhishekram404 avatar Apr 06 '24 05:04 abhishekram404