FIX getWeekNumbersOfMonth() drops the last week when the month ends on a Monday (#39185)
getWeekNumbersOfMonth() looped with "for ($day = 1; $day < $nb_days; ...)", so the last day of the month was never inspected. When that last day is a Monday it starts a new ISO week that no earlier day of the month belongs to, so its week number was silently missing from the returned array. This surfaces in the project "time spent per month" view (htdocs/projet/activity/permonth.php), which builds one column per week from this list: for such months the final week column is dropped. Over 2015-2035, 35 months are affected (e.g. 2015-08 returned weeks 31-35 but omitted 36, the week of Monday 2015-08-31). Fix: iterate up to and including the last day ($day <= $nb_days). Signed-off-by: TowyTowy <towy@airreps.link> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b67c468eaf
commit
acf69ceeee
1 changed files with 1 additions and 1 deletions
|
|
@ -1178,7 +1178,7 @@ function getWeekNumbersOfMonth($month, $year)
|
|||
{
|
||||
$nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
|
||||
$TWeek = array();
|
||||
for ($day = 1; $day < $nb_days; $day++) {
|
||||
for ($day = 1; $day <= $nb_days; $day++) {
|
||||
$week_number = getWeekNumber($day, $month, $year);
|
||||
$TWeek[$week_number] = $week_number;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue