X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FDateTimeFormat.php;h=8545cd07c43668ac938e16feff57135ebc425a31;hb=fa1328625cfa539bba0f8b244ef1e6073030b5bf;hp=31876d742b9419d8c45d342cbae31ffca4615b9e;hpb=342b9af73431aeda10b331f36e13bf5e69a2d58d;p=friendica.git diff --git a/src/Util/DateTimeFormat.php b/src/Util/DateTimeFormat.php index 31876d742b..8545cd07c4 100644 --- a/src/Util/DateTimeFormat.php +++ b/src/Util/DateTimeFormat.php @@ -6,6 +6,7 @@ namespace Friendica\Util; +use Friendica\Core\Logger; use DateTime; use DateTimeZone; use Exception; @@ -109,6 +110,9 @@ class DateTimeFormat * months and days always start with 1. */ if (substr($s, 0, 10) <= '0001-01-01') { + if ($s < '0000-00-00') { + $s = '0000-00-00'; + } $d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC')); return str_replace('1', '0', $d->format($format)); } @@ -122,7 +126,7 @@ class DateTimeFormat try { $d = new DateTime($s, $from_obj); } catch (Exception $e) { - logger('DateTimeFormat::convert: exception: ' . $e->getMessage()); + Logger::log('DateTimeFormat::convert: exception: ' . $e->getMessage()); $d = new DateTime('now', $from_obj); }