@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1#!/usr/bin/env php
2<?php
3
4$root = dirname(dirname(dirname(__FILE__)));
5require_once $root.'/scripts/init/init-script.php';
6
7$xml = $root.'/externals/cldr/cldr_windows_timezones.xml';
8$xml = Filesystem::readFile($xml);
9$xml = new SimpleXMLElement($xml);
10
11$result_map = array();
12
13$ignore = array(
14 'UTC',
15 'UTC-11',
16 'UTC-02',
17 'UTC-08',
18 'UTC-09',
19 'UTC+12',
20);
21$ignore = array_fuse($ignore);
22
23$zones = $xml->windowsZones->mapTimezones->mapZone;
24foreach ($zones as $zone) {
25 $windows_name = (string)$zone['other'];
26 $target_name = (string)$zone['type'];
27
28 // Ignore the offset-based timezones from the CLDR map, since we handle
29 // these later.
30 if (isset($ignore[$windows_name])) {
31 continue;
32 }
33
34 // We've already seen this timezone so we don't need to add it to the map
35 // again.
36 if (isset($result_map[$windows_name])) {
37 continue;
38 }
39
40 $result_map[$windows_name] = $target_name;
41}
42
43asort($result_map);
44
45echo id(new PhutilJSON())
46 ->encodeFormatted($result_map);