From d654dfbec0ded14133aeeb8f14f284e6927a606d Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 17 Jan 2025 07:51:21 +0100 Subject: [PATCH] Fix for empty start date becoming 1970 --- application/controllers/Update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/Update.php b/application/controllers/Update.php index c7de7232c..05fddd2ff 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -123,7 +123,7 @@ class Update extends CI_Controller { 'cont' => (string) $record->cont, 'long' => (float) $record->long, 'lat' => (float) $record->lat, - 'start' => $record->start ? date('Y-m-d H:i:s', strtotime($record->start)) : null, + 'start' => (!empty($record->start) && strtotime($record->start)) ? date('Y-m-d H:i:s', strtotime($record->start)) : null, 'end' => $record->end ? date('Y-m-d H:i:s', strtotime($record->end)) : null, ]; @@ -174,7 +174,7 @@ class Update extends CI_Controller { 'cont' => (string) $record->cont, 'long' => (float) $record->long, 'lat' => (float) $record->lat, - 'start' => $record->start ? date('Y-m-d H:i:s', strtotime($record->start)) : null, + 'start' => (!empty($record->start) && strtotime($record->start)) ? date('Y-m-d H:i:s', strtotime($record->start)) : null, 'end' => $record->end ? date('Y-m-d H:i:s', strtotime($record->end)) : null, ];