From e3680dcefb5429edc4f483634d972a6fcbe31077 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 6 Sep 2024 16:51:33 +0200 Subject: [PATCH] fix schedule problem when same month and day --- site/models/event.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/site/models/event.php b/site/models/event.php index 867a42a..96ca828 100644 --- a/site/models/event.php +++ b/site/models/event.php @@ -16,8 +16,14 @@ class EventPage extends Page { $endDay = intval($lastSession->toDate('d')); $endMonth = $lastSession->toDate('MMMM'); - if ($firstSession->toDate('y-M') === $lastSession->toDate('y-M')) { - return $startDay . ' - ' . $endDay . ' ' . $endMonth; + $isSameMonth = $firstSession->toDate('y-M') === $lastSession->toDate('y-M'); + $isSameDay = $firstSession->toDate('d') === $lastSession->toDate('d'); + if ($isSameMonth) { + if ($isSameDay) { + return $startDay . ' ' . $endMonth; + } else { + return $startDay . ' - ' . $endDay . ' ' . $endMonth; + } } else { return $startDay . ' ' . $startMonth . ' - ' . $endDay . ' ' . $endMonth; }