grav-plugin-events icon indicating copy to clipboard operation
grav-plugin-events copied to clipboard

No end date causes site crash

Open diegovogel opened this issue 7 years ago • 1 comments

I have a site with dozens of events on it (shows for a musician) and most have no end date, only a start date. This site works perfectly fine on a live server but I downloaded it today to make some changes on my local server and the site crashed with error: "Undefined index: end". This was highlighted in eventsProcessor.php: image

On one hand this makes sense, it's looking for an event end date and none of my events have that. On the other hand, I have no problems on my live server. Any ideas why?

Perhaps a check could be added to eventsProcessor.php to only add the end date to the event object if the end date exists. I tried this out and it works great:

if ( isset( $event['end'] ) ) {
    $carbonEvent['end'] = Carbon::parse( $event['end'] );
}

diegovogel avatar Jan 29 '18 13:01 diegovogel

Nice solution, works for me too.

webfed avatar Oct 27 '18 12:10 webfed