Skip to content

Commit

Permalink
Merge pull request #8328 from Sesquipedalian/3.0/tz_update
Browse files Browse the repository at this point in the history
Support recent change in tzdb to use %z for abbreviations
  • Loading branch information
Sesquipedalian authored Oct 24, 2024
2 parents 9fceb31 + a62da78 commit 40db891
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions other/update_timezones.php
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ private function buildTransitions(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'];

Expand Down Expand Up @@ -1895,7 +1895,7 @@ private function buildTransitions(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'];

Expand Down Expand Up @@ -2008,7 +2008,7 @@ private function buildTransitions(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'];

Expand Down Expand Up @@ -2412,7 +2412,7 @@ private function getDistanceFrom($this_zone, $from_zone): float
*/
private function rewriteDateString(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 = [
Expand Down

0 comments on commit 40db891

Please sign in to comment.