Skip to content

Commit

Permalink
Fix problem with the wrong minicalendars being shown in the month vie…
Browse files Browse the repository at this point in the history
…w when you're at the end of the month (eg Aug 31) and the next month has fewer days than the current one.
  • Loading branch information
campbell-m committed Sep 1, 2023
1 parent 5f8ed15 commit 7bffbd1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/js/datepicker.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ function monthStart(date) {

function monthEnd(date) {
var d = new Date(date);
<?php
// Set the date to the first of the month, because otherwise we will
// advance by two months when incrementing the month below if we're at the
// end of the month and the next month has fewer days than this one.
?>
d.setDate(1);
d.setMonth(d.getMonth() + 1);
d.setDate(0);
return d.toISOString().split('T')[0];
Expand Down

0 comments on commit 7bffbd1

Please sign in to comment.