Skip to content

Conversation

@yashwanthm
Copy link

The month increment decrement operator is buggy and this should help increment the month correctly.
February as a month doesn't get constructed in some cases when done this way:

if (isFutureDate) {
 monthIterator.setMonth(monthIterator.getMonth() + 1);
} else {
 monthIterator.setMonth(monthIterator.getMonth() - 1);
}

This should take care of it correctly.

if (isFutureDate) {
 monthIterator.setMonth(monthIterator.getMonth() + 1, 1);
} else {
 monthIterator.setMonth(monthIterator.getMonth() - 1, 1);
}

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