@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix two minor timezone display issues

Summary:
Ref T13263. Two minor issues:

- The "reconcile" dialog shows the wrong sign because JS signs differ from normal signs (for example, PST or PDT or whatever we're in right now is shown as "UTC+7", but should be "UTC-7").
- The big dropdown of possible timezones lumps "UTC+X:30" timezones into "UTC+X".

Test Plan:
- Reconciled "America/Nome", saw negative UTC offsets for "America/Nome" and "America/Los_Angeles" (previously: improperly positive).
- Viewed the big timzone list, saw ":30" and ":45" timezones grouped/labeled more accurately.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13263

Differential Revision: https://secure.phabricator.com/D20314

+13 -5
+5
src/applications/settings/controller/PhabricatorSettingsTimezoneController.php
··· 113 113 } 114 114 115 115 private function formatOffset($offset) { 116 + // This controller works with client-side (Javascript) offsets, which have 117 + // the opposite sign we might expect -- for example "UTC-3" is a positive 118 + // offset. Invert the sign before rendering the offset. 119 + $offset = -1 * $offset; 120 + 116 121 $hours = $offset / 60; 117 122 // Non-integer number of hours off UTC? 118 123 if ($offset % 60) {
+8 -5
src/applications/settings/setting/PhabricatorTimezoneSetting.php
··· 57 57 $groups = array(); 58 58 foreach ($timezones as $timezone) { 59 59 $zone = new DateTimeZone($timezone); 60 - $offset = -($zone->getOffset($now) / (60 * 60)); 60 + $offset = ($zone->getOffset($now) / 60); 61 61 $groups[$offset][] = $timezone; 62 62 } 63 63 64 - krsort($groups); 64 + ksort($groups); 65 65 66 66 $option_groups = array( 67 67 array( ··· 71 71 ); 72 72 73 73 foreach ($groups as $offset => $group) { 74 - if ($offset >= 0) { 75 - $label = pht('UTC-%d', $offset); 74 + $hours = $offset / 60; 75 + $minutes = abs($offset % 60); 76 + 77 + if ($offset % 60) { 78 + $label = pht('UTC%+d:%02d', $hours, $minutes); 76 79 } else { 77 - $label = pht('UTC+%d', -$offset); 80 + $label = pht('UTC%+d', $hours); 78 81 } 79 82 80 83 sort($group);