From: Hypolite Petovan Date: Mon, 9 Jan 2023 13:51:20 +0000 (-0500) Subject: Add yet another case to DateTimeFormat::fix X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6bee344681f78eab5e8d727c5a78e0a361a75e85;p=friendica.git Add yet another case to DateTimeFormat::fix - Address https://github.com/friendica/friendica/issues/12488#issuecomment-1372637862 --- diff --git a/src/Util/DateTimeFormat.php b/src/Util/DateTimeFormat.php index bbdf2d2c65..df7b6d92c4 100644 --- a/src/Util/DateTimeFormat.php +++ b/src/Util/DateTimeFormat.php @@ -182,8 +182,8 @@ class DateTimeFormat */ public static function fix(string $dateString): string { - $search = ['Mär', 'März', 'Mai', 'Juni', 'Juli', 'Okt', 'Dez', 'ET' , 'ZZ', ' - ', '+', ' (Coordinated Universal Time)']; - $replace = ['Mar', 'Mar' , 'May', 'Jun' , 'Jul' , 'Oct', 'Dec', 'EST', 'Z' , ', ' , '+' , '']; + $search = ['Mär', 'März', 'Mai', 'Juni', 'Juli', 'Okt', 'Dez', 'ET' , 'ZZ', ' - ', '+', '+', ' (Coordinated Universal Time)']; + $replace = ['Mar', 'Mar' , 'May', 'Jun' , 'Jul' , 'Oct', 'Dec', 'EST', 'Z' , ', ' , '+' , '+' , '']; $dateString = str_replace($search, $replace, $dateString); diff --git a/tests/src/Util/DateTimeFormatTest.php b/tests/src/Util/DateTimeFormatTest.php index 82a294dd6e..c4e2127bad 100644 --- a/tests/src/Util/DateTimeFormatTest.php +++ b/tests/src/Util/DateTimeFormatTest.php @@ -130,6 +130,10 @@ class DateTimeFormatTest extends MockedTest '(Coordinated Universal Time)' => [ 'expectedDate' => '2022-12-30T14:29:10+00:00', 'dateString' => 'Fri Dec 30 2022 14:29:10 GMT+0000 (Coordinated Universal Time)', + ], + 'Double HTML encode' => [ + 'expectedDate' => '2015-05-22T08:48:00+12:00', + 'dateString' => '2015-05-22T08:48:00+12:00' ] ]; }