mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Show more of UTC offset when user's TZ is not an integer number of hours offset
Summary: See https://discourse.phabricator-community.org/t/personal-timezone-setting-mismatch-cleared-and-more-specific-cases/1680. The code has always worked correctly, but the resulting timezone mismatch warning messsage wasn't specific enough when the mismatch is by a non-integer number of hours. Test Plan: Set timezone locally to Asia/Vladivostok and in Phabricator to Australia/Adelaide (which as of today's date are 30 minutes apart) and observed a more precise error message: F6061330 Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D19873
This commit is contained in:
parent
2814d34036
commit
5cb462d511
1 changed files with 7 additions and 6 deletions
|
@ -63,7 +63,7 @@ final class PhabricatorSettingsTimezoneController
|
|||
|
||||
$server_offset = $viewer->getTimeZoneOffset();
|
||||
|
||||
if ($client_offset == $server_offset || $did_calibrate) {
|
||||
if (($client_offset == $server_offset) || $did_calibrate) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Timezone Calibrated'))
|
||||
->appendParagraph(
|
||||
|
@ -113,12 +113,13 @@ final class PhabricatorSettingsTimezoneController
|
|||
}
|
||||
|
||||
private function formatOffset($offset) {
|
||||
$offset = $offset / 60;
|
||||
|
||||
if ($offset >= 0) {
|
||||
return pht('UTC-%d', $offset);
|
||||
$hours = $offset / 60;
|
||||
// Non-integer number of hours off UTC?
|
||||
if ($offset % 60) {
|
||||
$minutes = abs($offset % 60);
|
||||
return pht('UTC%+d:%02d', $hours, $minutes);
|
||||
} else {
|
||||
return pht('UTC+%d', -$offset);
|
||||
return pht('UTC%+d', $hours);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue