From 6ae54ba9d0644dca252fb977d5f700f41f52c321 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 18 Aug 2024 16:15:13 +0200 Subject: [PATCH] Fix error 500 for certain date/time variations --- application/controllers/Contestcalendar.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/Contestcalendar.php b/application/controllers/Contestcalendar.php index a6e80a5e9..a3b58978b 100644 --- a/application/controllers/Contestcalendar.php +++ b/application/controllers/Contestcalendar.php @@ -144,8 +144,8 @@ class Contestcalendar extends CI_Controller { continue; } - $start = date('Y-m-d', strtotime($contest['start']->format('Y-m-d'))); - $end = date('Y-m-d', strtotime($contest['end']->format('Y-m-d'))); + $start = $contest['start'] == '' ? '' : date('Y-m-d', strtotime($contest['start']->format('Y-m-d'))); + $end = $contest['end'] == '' ? '' : date('Y-m-d', strtotime($contest['end']->format('Y-m-d'))); if ($start <= $this->today && $end >= $this->today) { $contestsToday[] = $contest; @@ -175,8 +175,8 @@ class Contestcalendar extends CI_Controller { continue; } - $start = date('Y-m-d', strtotime($contest['start']->format('Y-m-d'))); - $end = date('Y-m-d', strtotime($contest['end']->format('Y-m-d'))); + $start = $contest['start'] == '' ? '' : date('Y-m-d', strtotime($contest['start']->format('Y-m-d'))); + $end = $contest['end'] == '' ? '' : date('Y-m-d', strtotime($contest['end']->format('Y-m-d'))); if ($start >= $nextFriday && $start <= $nextSunday && $start >= $this->today) { $contestsNextWeekend[] = $contest;