]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4742 from annando/negative-dates
authorHypolite Petovan <mrpetovan@gmail.com>
Wed, 4 Apr 2018 19:08:01 +0000 (15:08 -0400)
committerGitHub <noreply@github.com>
Wed, 4 Apr 2018 19:08:01 +0000 (15:08 -0400)
Avoid "Failed to parse time string (-001-11-30T00:00:00+00:00 + 32 days)"

src/Util/DateTimeFormat.php

index 31876d742b9419d8c45d342cbae31ffca4615b9e..e293857acdd14a937fbc45b19bffe31fc4aecfce 100644 (file)
@@ -109,6 +109,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));
                }