]> git.mxchange.org Git - friendica.git/commitdiff
Update src/Util/DateTimeFormat.php
authorMichael Vogel <icarus@dabo.de>
Mon, 3 Oct 2022 17:04:49 +0000 (19:04 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Oct 2022 17:04:49 +0000 (19:04 +0200)
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
src/Util/DateTimeFormat.php

index 96cddfeec928e19165677fba30f984b83e5f44a0..b790e1f6411aa77ed4f2105ce3b77924ba4e544c 100644 (file)
@@ -183,18 +183,18 @@ class DateTimeFormat
         */
        private static function fixDateFormat(string $dateString): string
        {
-               $pattern =
-                       [
-                               ['#(\w+), (\d+/\d+/\d+) - (\d+:\d+)#', '$1, $2 $3'],
-                               ['#(\d+-\d+-\d+)T(\d+:\d+:\d+)ZZ#', '$1T$2Z'],
-                               ['#(\d+-\d+-\d+)T(\d+:\d+:\d+\.\d+)ZZ#', '$1T$2Z'],
-                               ['#(\w+), (\d+ \w+ \d+) (\d+:\d+:\d+) (.+)#', '$2 $3 $4'],
-                               ['#(\d+:\d+) (\w+), (\w+) (\d+), (\d+)#', '$1 $2 $3 $4 $5'],
-                       ];
-
-               foreach ($pattern as $search_replace) {
-                       $dateString = preg_replace($search_replace[0], $search_replace[1], $dateString);
+               $patterns = [
+                       ['#(\w+), (\d+/\d+/\d+) - (\d+:\d+)#', '$1, $2 $3'],
+                       ['#(\d+-\d+-\d+)T(\d+:\d+:\d+)ZZ#', '$1T$2Z'],
+                       ['#(\d+-\d+-\d+)T(\d+:\d+:\d+\.\d+)ZZ#', '$1T$2Z'],
+                       ['#(\w+), (\d+ \w+ \d+) (\d+:\d+:\d+) (.+)#', '$2 $3 $4'],
+                       ['#(\d+:\d+) (\w+), (\w+) (\d+), (\d+)#', '$1 $2 $3 $4 $5'],
+               ];
+
+               foreach ($patterns as $pattern) {
+                       $dateString = preg_replace($pattern[0], $pattern[1], $dateString);
                }
+               
                return $dateString;
        }