Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
I'm developing a modal component using the TimePicker, and I've encountered a problem. I'm using React and trying to implement some functionalities with useRef(). When I use the onMonthDropdownChange function, something unexpected happens.
For example: If the modal is set to October and I try to change it to June, the calendar switches to July instead.
Case Study
After researching this topic, I found that:
When using JavaScript’s new Date() to switch between months with a different number of days, a shift to the following month can occur.
Solution
To resolve this, I set the default date to the first day of the selected month.