Page MenuHomePhabricator

D20314.diff
No OneTemporary

D20314.diff

diff --git a/src/applications/settings/controller/PhabricatorSettingsTimezoneController.php b/src/applications/settings/controller/PhabricatorSettingsTimezoneController.php
--- a/src/applications/settings/controller/PhabricatorSettingsTimezoneController.php
+++ b/src/applications/settings/controller/PhabricatorSettingsTimezoneController.php
@@ -113,6 +113,11 @@
}
private function formatOffset($offset) {
+ // This controller works with client-side (Javascript) offsets, which have
+ // the opposite sign we might expect -- for example "UTC-3" is a positive
+ // offset. Invert the sign before rendering the offset.
+ $offset = -1 * $offset;
+
$hours = $offset / 60;
// Non-integer number of hours off UTC?
if ($offset % 60) {
diff --git a/src/applications/settings/setting/PhabricatorTimezoneSetting.php b/src/applications/settings/setting/PhabricatorTimezoneSetting.php
--- a/src/applications/settings/setting/PhabricatorTimezoneSetting.php
+++ b/src/applications/settings/setting/PhabricatorTimezoneSetting.php
@@ -57,11 +57,11 @@
$groups = array();
foreach ($timezones as $timezone) {
$zone = new DateTimeZone($timezone);
- $offset = -($zone->getOffset($now) / (60 * 60));
+ $offset = ($zone->getOffset($now) / 60);
$groups[$offset][] = $timezone;
}
- krsort($groups);
+ ksort($groups);
$option_groups = array(
array(
@@ -71,10 +71,13 @@
);
foreach ($groups as $offset => $group) {
- if ($offset >= 0) {
- $label = pht('UTC-%d', $offset);
+ $hours = $offset / 60;
+ $minutes = abs($offset % 60);
+
+ if ($offset % 60) {
+ $label = pht('UTC%+d:%02d', $hours, $minutes);
} else {
- $label = pht('UTC+%d', -$offset);
+ $label = pht('UTC%+d', $hours);
}
sort($group);

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 5:44 AM (18 h, 55 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6781385
Default Alt Text
D20314.diff (1 KB)

Event Timeline