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

fix utils.getMonthsForYear() to account for months shorter than that … #150

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

Conversation

meta-meta
Copy link

…of the selected date; resolves #140

@clauderic
Copy link
Owner

Hmm, would you care to elaborate a little about this solution?

@meta-meta
Copy link
Author

new Date(2017, 1, 28)
Tue Feb 28 2017 00:00:00 GMT-0600 (Central Standard Time)
new Date(2017, 1, 31)
Fri Mar 03 2017 00:00:00 GMT-0600 (Central Standard Time)

If the day passed to getMonthsForYear is greater than the number of days in that month, you end up getting the following month. Result being in your year view, you end up with Jan Mar Mar May May...

So the proposed solution is to constrain the day to fall within the month. Math.min returns the lesser of n values.

@fra-smw
Copy link

fra-smw commented Nov 21, 2017

Hi, is there any plan to merge this PR?

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.

docs duplicate some months, miss others
3 participants