Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATE: Add newViewDate.setDate(1) #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devgl96
Copy link

@devgl96 devgl96 commented Oct 31, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant