From 76c93ed1d7d9a60a225c03112d207babfc739207 Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Thu, 24 Oct 2024 14:01:27 -0600 Subject: [PATCH] Support recent change in tzdb to use %z for abbreviations Signed-off-by: Jon Stovell --- other/update_timezones.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/other/update_timezones.php b/other/update_timezones.php index 1b7c1aaf9b..9eee71807e 100644 --- a/other/update_timezones.php +++ b/other/update_timezones.php @@ -1944,7 +1944,7 @@ private function build_timezone_transitions(bool $rebuild = false): void $time = $entry_start->format('Y-m-d\TH:i:sO'); $offset = $std_offset; $isdst = false; - $abbr = sprintf($entry['format'], 'S'); + $abbr = $entry['format'] === '%z' ? sprintf("%+03d", strtr($offset, [':00' => '', ':' => ''])) : sprintf($entry['format'], 'S'); $save = 0; $unadjusted_date_string = $unadjusted_date_strings['entry_start']; @@ -1982,7 +1982,7 @@ private function build_timezone_transitions(bool $rebuild = false): void $time = $entry_start->format('Y-m-d\TH:i:sO'); $offset = $std_offset + $rules_offset; $isdst = true; - $abbr = sprintf($entry['format'], 'D'); + $abbr = $entry['format'] === '%z' ? sprintf("%+03d", strtr($offset, [':00' => '', ':' => ''])) : sprintf($entry['format'], 'D'); $save = $rules_offset; $unadjusted_date_string = $unadjusted_date_strings['entry_start']; @@ -2108,7 +2108,7 @@ private function build_timezone_transitions(bool $rebuild = false): void $time = $transition_date->format('Y-m-d\TH:i:sO'); $offset = $std_offset + $save_offset; $isdst = $save_offset != 0; - $abbr = sprintf($entry['format'], $info['letter'] === '-' ? '' : $info['letter']); + $abbr = $entry['format'] === '%z' ? sprintf("%+03d", strtr($offset, [':00' => '', ':' => ''])) : (sprintf($entry['format'], $info['letter'] === '-' ? '' : $info['letter'])); $save = $save_offset; $unadjusted_date_string = $info['unadjusted_date_string']; @@ -2514,7 +2514,7 @@ private function get_distance_from($this_zone, $from_zone): float */ private function rewrite_date_string(string $date_string): string { - $month = 'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec'; + $month = 'Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sept?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?'; $weekday = 'Sun|Mon|Tue|Wed|Thu|Fri|Sat'; $replacements = array(