From 1a765e32b0d8ca5cc80c860bdc42a498d0a1979f Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Fri, 17 Nov 2017 11:00:07 +0800 Subject: [PATCH] MDL-60823 calendar: use first day of week on prepadding calc --- calendar/classes/external/month_exporter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/calendar/classes/external/month_exporter.php b/calendar/classes/external/month_exporter.php index 12b910ee0bf..b735d36d12e 100644 --- a/calendar/classes/external/month_exporter.php +++ b/calendar/classes/external/month_exporter.php @@ -274,13 +274,12 @@ class month_exporter extends exporter { // Calculate which day number is the first, and last day of the week. $firstdayofweek = $this->firstdayofweek; - $lastdayofweek = ($firstdayofweek + $daysinweek - 1) % $daysinweek; // The first week is special as it may have padding at the beginning. $day = reset($alldays); $firstdayno = $day['wday']; - $prepadding = ($firstdayno + $daysinweek - 1) % $daysinweek; + $prepadding = ($firstdayno + $daysinweek - $firstdayofweek) % $daysinweek; $daysinfirstweek = $daysinweek - $prepadding; $days = array_slice($alldays, 0, $daysinfirstweek); $week = new week_exporter($this->calendar, $days, $prepadding, ($daysinweek - count($days) - $prepadding), $this->related); -- 2.11.4.GIT