Fix error 500 for certain date/time variations

This commit is contained in:
Andreas Kristiansen
2024-08-18 16:15:13 +02:00
parent 647c41c99d
commit 6ae54ba9d0

View File

@@ -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;