Forum

Thread tagged as: Error

Calendar Next 2 Months

This isn't an issue for me now, but just thought I'd let you know that I have a calendar set up to display this month and the next 2 months events. This was all working fine until for some reason yesterday (31st May) The calendar view for the next 2 months were blank and were both displaying the title May, instead of June and July. This morning (June 1st), this is all back to normal and working perfectly so not a problem for me but just thought there might be a fix required.

regards

Rich

Richard Lowe

Richard Lowe 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What code are you using to display your calendar?

Richard Lowe

Richard Lowe 0 points
Registered Developer

<?php

$_GET['d']  = date('Y-m', strtotime('+1 MONTH'));
perch_events_calendar(array(
'past-events'        => true,
'calendar-template'  => 'events/calendar/calendar_next.html',
'blank-day-template' => 'events/calendar/blank-day.html',
'event-day-template' => 'events/calendar/event-day.html'

));

?>

<?php

$_GET['d']  = date('Y-m', strtotime('+2 MONTH'));
perch_events_calendar(array(
'past-events'        => true,
'calendar-template'  => 'events/calendar/calendar_next.html',
'blank-day-template' => 'events/calendar/blank-day.html',
'event-day-template' => 'events/calendar/event-day.html'

));

?>

Drew McLellan

Drew McLellan 2638 points
Perch Support

I guess it comes down to how that +1 MONTH is interpreted.

What is 31 May +1 month?

30 June is less than a month. 1 July is arguably more.

Richard Lowe

Richard Lowe 0 points
Registered Developer

Of course, yes, wasn't a problem anyway

Drew McLellan

Drew McLellan 2638 points
Perch Support

Valid question though! I'm not sure of the answer, but I'll think on it.