From cc082d051013838718de5c54dab978df85735a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Andr=C3=A9=20Vullioud?= Date: Fri, 30 Mar 2018 18:06:47 +0200 Subject: [PATCH] Return empty from Backend::dateTime instead of current date (#3246) This changes Backend::dateTime to return an empty string instead of the current date when dealing with a null date. It should only affect the date field preview instance. Credit to @pvullioud --- modules/backend/helpers/Backend.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/backend/helpers/Backend.php b/modules/backend/helpers/Backend.php index cbc084999..095207d46 100644 --- a/modules/backend/helpers/Backend.php +++ b/modules/backend/helpers/Backend.php @@ -118,6 +118,10 @@ class Backend 'timeSince' => false, 'ignoreTimezone' => false, ], $options)); + + if(!$dateTime) { + return ''; + } $carbon = DateTimeHelper::makeCarbon($dateTime);