From 60e43626a275a652b57336729614664413a2abe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20LEHOUX?= Date: Sun, 21 Dec 2025 23:14:23 +0100 Subject: [PATCH 1/2] fix a bug where calculOccurence() would return dates outside the input range when called on an event with includeDates --- core/class/calendar.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/class/calendar.class.php b/core/class/calendar.class.php index 4394743..7394877 100644 --- a/core/class/calendar.class.php +++ b/core/class/calendar.class.php @@ -843,6 +843,10 @@ public function calculOccurrence($_startDate, $_endDate, $_max = 9999999999, $_r $enddatetime = strtotime(date('Y-m-d 00:00:00', strtotime($this->getEndDate()))); $diff_day = floor(($enddatetime - $startdatetime) / 86400); foreach ($includeDate as $date) { + /* ignore the included date if outside the range */ + if ((strtotime($date) > strtotime($_endDate)) || (strtotime($date) < strtotime($_startDate))) { + continue; + } foreach ($return as $value) { if ($value['start'] == $date . ' ' . $initStartTime && $value['end'] == $date . ' ' . $initEndTime) { continue (2); From a6e3a10c5c603aee0d628346d2b7b7b4e8cc1894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20LEHOUX?= Date: Sun, 11 Jan 2026 17:37:47 +0100 Subject: [PATCH 2/2] fix a bug where empty date range was not correctly handled --- core/class/calendar.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/class/calendar.class.php b/core/class/calendar.class.php index 7394877..d957392 100644 --- a/core/class/calendar.class.php +++ b/core/class/calendar.class.php @@ -843,10 +843,12 @@ public function calculOccurrence($_startDate, $_endDate, $_max = 9999999999, $_r $enddatetime = strtotime(date('Y-m-d 00:00:00', strtotime($this->getEndDate()))); $diff_day = floor(($enddatetime - $startdatetime) / 86400); foreach ($includeDate as $date) { - /* ignore the included date if outside the range */ - if ((strtotime($date) > strtotime($_endDate)) || (strtotime($date) < strtotime($_startDate))) { - continue; - } + /* if range provided, ignore the included date if outside the range */ + if (!empty($_endDate) && !empty($_startDate)) { + if ((strtotime($date) > strtotime($_endDate)) || (strtotime($date) < strtotime($_startDate))) { + continue; + } + } foreach ($return as $value) { if ($value['start'] == $date . ' ' . $initStartTime && $value['end'] == $date . ' ' . $initEndTime) { continue (2);