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

Goto next month issue on 31st #146

Closed
zac-robinson opened this issue Oct 31, 2023 · 2 comments
Closed

Goto next month issue on 31st #146

zac-robinson opened this issue Oct 31, 2023 · 2 comments

Comments

@zac-robinson
Copy link
Contributor

When on the 31st of a month, (31/10 for example) if you click the jump to next month button in the calendar then you get moved 2 month into the future (December).

Replicated on the docs page: https://mskocik.github.io/svelty-picker/

Only seems to happen on initial load, if you navigate back to October and select the 31st, then click next month you are taken to November as expected

@garikAsplund
Copy link
Contributor

garikAsplund commented Nov 5, 2023

This looks like a simple fix--the issue comes from adding a month via the Date object in JS. If the next month doesn't have as many days, then it rolls over to the following month. This'll happen, too, if you select January 29 and hit 'next' as February only has 28 days. See here.

I'll see if my quick patch is enough for a pull request or if it messes up a variable elsewhere. First time laying eyes on this so don't really know for sure.

@mskocik mskocik closed this as completed in b5d835a Nov 5, 2023
@mskocik
Copy link
Owner

mskocik commented Nov 5, 2023

@garikAsplund your PR was good, I just added fix for keyboard navigation as well. Thanks for help.

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

No branches or pull requests

3 participants