Event Calendar - weekly view
81 posts by 2 authors in: Forums > CMS Builder
Last Post: Yesterday at 1:15am (RSS)
By Djulia - November 12 - edited: November 13
If you don't want to use the Ajax version, you just need to remove the JavaScript calls:
<script src="calendar.js" defer></script>
If you prefer to keep the current version of your calendar, you can try modifying the renderWeekView() function directly.
In calendar_functions.php, replace:
// Check if the event should be displayed
if (
($isSameDay && $currentDate === $eventStart->format('Y-m-d') && $hour >= (int)$eventStart->format('H') && $hour < (int)$eventEnd->format('H')) ||
(!$isSameDay && (
($currentDate === $eventStart->format('Y-m-d') && $hour >= (int)$eventStart->format('H')) ||
($currentDate === $eventEnd->format('Y-m-d') && $hour < (int)$eventEnd->format('H')) ||
($currentDate > $eventStart->format('Y-m-d') && $currentDate < $eventEnd->format('Y-m-d'))
))
) {
renderWeekEvent($event, $eventTimeDisplay, $currentHour, $workingStart, $workingEnd);
}
with:
// Check if the event should be displayed
if (
// Case 1: Short event on the same day (e.g., 5 minutes)
($isSameDay && $currentDate === $eventStart->format('Y-m-d') &&
$currentHour >= $eventStart && $currentHour <= $eventEnd) ||
// Case 2: Long event on the same day (e.g., 9:00 AM to 5:00 PM)
($isSameDay && $currentDate === $eventStart->format('Y-m-d') && (
$hour >= (int)$eventStart->format('H') && $hour <= (int)$eventEnd->format('H')
)) ||
// Case 3: Multi-day event
(!$isSameDay && (
($currentDate === $eventStart->format('Y-m-d') && $hour >= (int)$eventStart->format('H')) || // Start day
($currentDate === $eventEnd->format('Y-m-d') && $hour < (int)$eventEnd->format('H')) || // End day
($currentDate > $eventStart->format('Y-m-d') && $currentDate < $eventEnd->format('Y-m-d')) // Intermediate days
))
) {
renderWeekEvent($event, $eventTimeDisplay, $currentHour, $workingStart, $workingEnd);
}
It should also work.
Thanks,
Djulia
By MercerDesign - November 12
Thank you, but that still doesn't work. The event just disappears when the time is 1.00 - 1.10
By Djulia - November 12
Could you send me an events file? I can’t seem to reproduce the issue. Thanks!
By Djulia - November 13
Hi MercerDesign,
Could you try with these two files in example mode?
I also added an event in the array():
[
'title' => 'Annual Conference',
'start_date' => '2024-11-13 13:00:00',
'end_date' => '2024-11-13 13:10:00',
'permalink' => 'annual-conference',
'description' => 'Annual conference on technological innovations.',
'location' => 'Main Auditorium',
'category' => 'conference'
],
Thanks,
Djulia
By MercerDesign - November 13 - edited: November 13
It doesn't work: https://rodneys46.sg-host.com/calendar/?year=2024&week=45&view=week
I update an event on Sunday 3rd November to be 1.00 - 1:10 and it just disapperas.
By Djulia - November 13 - edited: November 13
Oops! In your calendar.php file, you need to place calendar_functions.php after viewer_functions.php.