try fix event

This commit is contained in:
isUnknown 2024-09-24 08:59:17 +02:00
parent 3809d96504
commit ece995352f
5 changed files with 14 additions and 15 deletions

View file

@ -4,6 +4,10 @@ class EventPage extends Page {
public function schedule() {
$sessions = $this->isMapadoEvent() != 'true' ? $this->sessions()->toStructure() : $this->remoteSessions()->toStructure();
if ($sessions->isEmpty()) {
throw new Exception('Can\'t define sessions for event "' . $this->title()->value() . '". No sessions found.', 1);
}
try {
$firstSession = $sessions->first()->date();
$lastSession = $sessions->last()->date();
@ -18,6 +22,7 @@ class EventPage extends Page {
$isSameMonth = $firstSession->toDate('y-M') === $lastSession->toDate('y-M');
$isSameDay = $firstSession->toDate('d') === $lastSession->toDate('d');
if ($isSameMonth) {
if ($isSameDay) {
return $startDay . ' ' . $endMonth;
@ -28,4 +33,4 @@ class EventPage extends Page {
return $startDay . ' ' . $startMonth . ' - ' . $endDay . ' ' . $endMonth;
}
}
}
}

View file

@ -23,7 +23,7 @@
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/locale/fr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/weekOfYear.js"></script>
<script src="<?= url('/assets/dist/calendar.min.js') ?>"></script>
<script src="<?= url('/assets/js/calendar.js') ?>"></script>
<?php endif ?>
<!-- Swiper -->

View file

@ -25,11 +25,7 @@
x-text="title"
:class="tab === title ? 'strong' : ''"
@click="
if (tab === title) {
tab = 'Programme'
} else {
tab = title
}
tab = title
const url = new URL(window.location.href);
url.searchParams.set('tab', tab);
@ -47,11 +43,7 @@
x-text="title"
:class="tab === filterTitle ? 'strong' : ''"
@click="
if (tab === filterTitle) {
tab = 'Programme'
} else {
tab = filterTitle; filter = title
}
tab = filterTitle; filter = title
const url = new URL(window.location.href);
url.searchParams.set('tab', tab);