I tried the approach that you, @Feshchenko, mentioned in your comments and used the offsetDate in order to achieve the desired behavior without needing to update the disabling logic.
This is an example of what the code does behind the scenes (the same happens in the videos attached below):
Situation 1 - Edge case maxDate:
Previously, the offsetDate was set to selectedDate but in my case:
Initial selectedDate = 20.1.2024
maxDate = 13.2024
(new) offsetDate = 13.1.2024 -> maxDate - 1 month (previously, the offset Date was 20.1.2024 which resulted in a disabled button)
Situation 2 - Edge case minDate:
initial selectedDate = 20.1.2024
minDate = 22.11.2023
offsetDate = 20.1.2024 - no change needed - same as the initial value
-> Now, the user clicks on the previous button, what happens next:
selectedDate remains unchanged
minDate remains unchanged
(new) offsetDate = 22.12.2023 -> minDate + 1 month (previously, the offset Date would be set to 20.12.2023 which resulted in a disabled button as 20.12.2023 - 1 month is less than minDate 22.11.2023)
Hello, This is my attempt to fix the behaviour described in https://github.com/rehookify/datepicker/pull/46
I tried the approach that you, @Feshchenko, mentioned in your comments and used the offsetDate in order to achieve the desired behavior without needing to update the disabling logic.
This is an example of what the code does behind the scenes (the same happens in the videos attached below):
Situation 1 - Edge case maxDate:
Situation 2 - Edge case minDate:
I'm also attaching the before and after showcases
Before: https://github.com/rehookify/datepicker/assets/17575434/2b4209a9-072c-4679-a7f5-99692b6643ea
After: https://github.com/rehookify/datepicker/assets/17575434/f8a20c7f-8153-40e9-9b94-0e70fc558820
Props setup from the video: mode: 'single' maxDate: 13.2.2024 minDate: 22.11.2024 selectedDates: [20.1.2024]
fyi @marianadrozdova @ebartunek