]> git.mxchange.org Git - friendica.git/commitdiff
Add new case to DateTimeFormat::fix
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 31 Dec 2022 02:40:37 +0000 (21:40 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 31 Dec 2022 02:40:37 +0000 (21:40 -0500)
- Address https://github.com/friendica/friendica/issues/12488#issuecomment-1368011436

src/Util/DateTimeFormat.php
tests/src/Util/DateTimeFormatTest.php

index 8233a4f5b604d456a375a695400826a45ca79032..6b11a5458031f9729a1631ea728b90c8558c9cb0 100644 (file)
@@ -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', ' - ', '&#x2B;'];
-               $replace = ['Mar', 'Mar' , 'May', 'Jun' , 'Jul' , 'Oct', 'Dec', 'EST', 'Z' , ', ' , '+'     ];
+               $search  = ['Mär', 'März', 'Mai', 'Juni', 'Juli', 'Okt', 'Dez', 'ET' , 'ZZ', ' - ', '&#x2B;', ' (Coordinated Universal Time)'];
+               $replace = ['Mar', 'Mar' , 'May', 'Jun' , 'Jul' , 'Oct', 'Dec', 'EST', 'Z' , ', ' , '+'     , ''];
 
                $dateString = str_replace($search, $replace, $dateString);
 
index 994ca3a113f82e263c398eee4e3d03c724dfffdb..41f646bada637629362fc35f8fec98d7c887211f 100644 (file)
@@ -126,6 +126,10 @@ class DateTimeFormatTest extends MockedTest
                        'German date time string' => [
                                'expectedDate' => '2022-10-05T16:34:00+02:00',
                                'dateString' => '05 Okt 2022 16:34:00 +0200',
+                       ],
+                       '(Coordinated Universal Time)' => [
+                               'expectedDate' => '2022-12-30T14:29:10+00:00',
+                               'dateString' => 'Fri Dec 30 2022 14:29:10 GMT+0000 (Coordinated Universal Time)',
                        ]
                ];
        }