Skip to content

Commit

Permalink
Fix bug: How many weeks does a given month overlap
Browse files Browse the repository at this point in the history
The bug is due to change Sunday to the last day of the week.  After change firstDayOfMonth from 0 to 7, we have to minus 1.

Ref:  0b68363#diff-e41a2cb50c3362f0015404effec8761e
  • Loading branch information
derekhu authored Jul 1, 2019
1 parent 7cd1f42 commit 9b7e53b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gadget/year.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
}
var daysInMonth = getDaysInMonth(firstDate);

return Math.ceil((firstDayOfMonth + daysInMonth) / 7)
return Math.ceil((firstDayOfMonth -1+ daysInMonth) / 7)
}

/**
Expand Down Expand Up @@ -316,4 +316,4 @@
</script>

</body>
</html>
</html>

0 comments on commit 9b7e53b

Please sign in to comment.