Event Calendar - weekly view
94 posts by 3 authors in: Forums > CMS Builder
Last Post: January 13 (RSS)
By MercerDesign - December 20 - edited: December 20
Hi, I did a CMS upgrade this morning to fix another issue but now any events after the 28th of December are not showing, can you help please? It only seems to be a problem on the week view.
By Djulia - December 20 - edited: December 20
Hi MercerDesign,
The issue appears to stem from improper handling of dates that span across two years in the week view, particularly during the transition from week 52/53 of one year to week 1 of the following year. This can lead to inconsistencies in the values generated for $week_start, $start, and $end.
Here is a corrected version for the query in the week view:
// Creates a date for the start of the given week (ISO year and ISO week)
$date = new DateTime();
$date->setISODate($year, $week); // Sets the date using the ISO year and week
// Format for the start and end of the week
$week_start = $date->format($FORMAT_START); // First day of the week
$start = $date->modify('-1 week')->format($FORMAT_START); // Start of the previous week
$end = $date->modify('+2 weeks -1 day')->format($FORMAT_END); // End of the following week
// SQL query to find events overlapping this period
$query = "start_date <= '$end' AND end_date >= '$start'";
Thanks,
Djulia
By kitsguru - January 13
Could you provide a final version of all the files and mods for the calendar. I used the original version many years ago, and think the work you have done would be very useful.
yaadev.com