Skip to content

Staying at the current month when selecting range. #3583

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

Closed
ymoon715 opened this issue May 6, 2022 · 5 comments
Closed

Staying at the current month when selecting range. #3583

ymoon715 opened this issue May 6, 2022 · 5 comments
Labels

Comments

@ymoon715
Copy link

ymoon715 commented May 6, 2022

Is your feature request related to a problem? Please describe.
I currently have time range picker, where a user selects either yearly/monthly, and if they select today's date, it automatically chooses the range from today's to either year ago or month ago. However when that happens, the month automatically changes to a month/year ago and there is no way for me to control that.

Describe the solution you'd like
A call back that I can use to control the year and the month im displaying, or a prop that prevents automatic change of year and date.

Describe alternatives you've considered
I went through the doc and tried to change this in custom header, but so far no luck.

Additional context
Is there any way to do this without using a hacky method like setTimeout?

@ymoon715
Copy link
Author

Currently, I'm using set time out, and the UI flickers to the current month/date after selecting dates beyond/below the current date.

Is there plans of creating headless react hooks that we can use to create the calendar and allow more customizations?

@un1tT
Copy link

un1tT commented May 25, 2022

@ymoon715 would you please share an example of your setTimeOut solution? Got this problem as well :/

@ymoon715
Copy link
Author

ymoon715 commented May 31, 2022

@ymoon715 would you please share an example of your setTimeOut solution? Got this problem as well :/

useEffect(() => { setTimeout(() => { if (to) { changeMonth(to.getMonth()); changeYear(to.getFullYear()); } }, 0); }, [frequency, from]);

The UI flickers, and this is probably the most brute force way you can achieve this. I dont recommend using setTimeout at all

Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Jun 17, 2024
Copy link

github-actions bot commented May 5, 2025

This issue was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants