Merge pull request #4742 from annando/negative-dates

Avoid "Failed to parse time string (-001-11-30T00:00:00+00:00 + 32 days)"
pull/4745/head
Hypolite Petovan 2018-04-04 15:08:01 -04:00 committed by GitHub
commit 16650733b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View 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));
}