Fix for empty start date becoming 1970

This commit is contained in:
Andreas Kristiansen
2025-01-17 07:51:21 +01:00
parent 554c2678fc
commit d654dfbec0

View File

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