From e8ce2c6e2bb858f9af664dbc5ac37edb958b8850 Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Mon, 4 Nov 2024 10:58:44 +0000 Subject: [PATCH] allow day 7 as sunday in getWeekday function, fixes #4801 Closes #4801 Merge request studip/studip!3592 --- lib/dates.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dates.inc.php b/lib/dates.inc.php index acd5109902b..9b8e26e1d9a 100644 --- a/lib/dates.inc.php +++ b/lib/dates.inc.php @@ -30,10 +30,10 @@ require_once 'lib/calendar_functions.inc.php'; */ function getWeekday(int $day_num, bool $short = true): string { - if ($day_num < 0 || $day_num > 6) { + if ($day_num < 0 || $day_num > 7) { throw new Exception('Invalid day number'); } - return match($day_num) { + return match($day_num % 7) { 0 => $short ? _('So') : _('Sonntag'), 1 => $short ? _('Mo') : _('Montag'), 2 => $short ? _('Di') : _('Dienstag'), -- GitLab