fix schedule problem when same month and day

This commit is contained in:
isUnknown 2024-09-06 16:51:33 +02:00
parent 96bcd73a0e
commit e3680dcefb

View file

@ -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;
}