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

September has 31 days when it should have 30 #40

Closed
brenoguim opened this issue Oct 1, 2019 · 3 comments · Fixed by #41
Closed

September has 31 days when it should have 30 #40

brenoguim opened this issue Oct 1, 2019 · 3 comments · Fixed by #41
Assignees
Milestone

Comments

@brenoguim
Copy link

I did not check other months.

@brenoguim brenoguim changed the title September is has 31 days September has 31 days when it should have 30 Oct 1, 2019
@thamara
Copy link
Owner

thamara commented Oct 1, 2019

Probably doing something wrong with the month number as js has the base habit of describing months from 0 to 11, and not 1 to 12

@dsrariel
Copy link
Contributor

dsrariel commented Oct 2, 2019

All days are right-shifted one month (e. g., March has 28 days on 2019). I search through _getBody() method on js/calendar.js. Lines 489-450 have the following code:

var d = new Date(this.year, this.month, 0),
            monthLength = d.getDate();

In that case, monthLength has the number of days of this.month - 1, that's why everything is shifted (just adding a one will cause other things to crash, though 😅 ).

@tupaschoal
Copy link
Collaborator

Apparently:

When you pass a 0 to the third argument instead, it uses the last day of the previous month

So calls calculating monthLength should take this into consideration.

tupaschoal added a commit to tupaschoal/time-to-leave that referenced this issue Oct 2, 2019
tupaschoal added a commit to tupaschoal/time-to-leave that referenced this issue Oct 2, 2019
tupaschoal added a commit to tupaschoal/time-to-leave that referenced this issue Oct 2, 2019
thamara pushed a commit that referenced this issue Oct 3, 2019
@thamara thamara added this to the Version 1.2.0 milestone Oct 18, 2019
@tupaschoal tupaschoal self-assigned this Oct 19, 2019
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 a pull request may close this issue.

4 participants