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

Ability to page by one month at a time #46

Closed
Cata1989 opened this issue May 27, 2024 · 5 comments · Fixed by #50
Closed

Ability to page by one month at a time #46

Cata1989 opened this issue May 27, 2024 · 5 comments · Fixed by #50
Labels
enhancement New feature or request

Comments

@Cata1989
Copy link

Scenario:

I have a multi-selectable calendar with months="1" to display one month per next/prev button press.
I aim to display two months at a time, moving one month forward/backward per button press (e.g., May/June => June/July).

Problem:

Selecting dates from the second displayed month causes the calendar to jump to the next month.
Setting months="2" matches the elements and works correctly, but the prev/next buttons then jump two months (e.g., May/June => July/August), which is not desired.

CodePen Example: https://codepen.io/Catalin-Lungan/pen/JjqozOe

Expected Resolution:

Currently, it is expected that the 'months' prop matches the number of elements, as the pagination logic moves by the number of months specified. It would be very useful to have a setting that allows configuring the pagination to move by a custom number of months, which would resolve the issue we're experiencing.

@WickyNilliams WickyNilliams changed the title Calendar Navigation Behavior Ability to page by one month at a time May 29, 2024
@WickyNilliams WickyNilliams added the enhancement New feature or request label May 29, 2024
@WickyNilliams
Copy link
Owner

hey i just made a PR that allows you to set pageBy="single", which i think should give you the behavior you want. see #50.

can you take a look at it?

@Cata1989
Copy link
Author

Cata1989 commented Jun 4, 2024

Hey @WickyNilliams , thank you for taking the time to look into this.

Yes, I've reviewed the changes in the PR, particularly the testing part, and the pageBy prop did the trick. I guess this solution will work great for us. Using pageBy="single" | "months" , pagination will be independent of the months prop, which is excellent.

@WickyNilliams
Copy link
Owner

That's right. I'll get this merged and released today

@WickyNilliams
Copy link
Owner

Released in 0.7.0

@WickyNilliams
Copy link
Owner

Just released 0.7.1 that contains some small enhancements to the pagination logic as i wasn't quite happy with how it behaved. It feels more natural now

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

Successfully merging a pull request may close this issue.

2 participants