From acf69ceeeef4e706d8aedc58574c89f28cdf4337 Mon Sep 17 00:00:00 2001 From: TowyTowy <85077986+TowyTowy@users.noreply.github.com> Date: Wed, 15 Jul 2026 20:42:56 +0200 Subject: [PATCH] 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 Co-authored-by: Claude --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 6d4585c41c9..d2d88114820 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -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; }