Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15425069
D15962.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D15962.id.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '8aeacc63',
- 'core.pkg.js' => '7b44c14f',
+ 'core.pkg.js' => '50e9228e',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '33da0633',
'differential.pkg.js' => '4b7d8f19',
@@ -477,7 +477,7 @@
'rsrc/js/core/behavior-choose-control.js' => '327a00d1',
'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae',
- 'rsrc/js/core/behavior-detect-timezone.js' => 'ae9f2ec9',
+ 'rsrc/js/core/behavior-detect-timezone.js' => '4c193c96',
'rsrc/js/core/behavior-device.js' => 'bb1dd507',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '484a6e22',
'rsrc/js/core/behavior-error-log.js' => '6882e80a',
@@ -602,7 +602,7 @@
'javelin-behavior-dashboard-tab-panel' => 'd4eecc63',
'javelin-behavior-day-view' => '5c46cff2',
'javelin-behavior-desktop-notifications-control' => 'edd1ba66',
- 'javelin-behavior-detect-timezone' => 'ae9f2ec9',
+ 'javelin-behavior-detect-timezone' => '4c193c96',
'javelin-behavior-device' => 'bb1dd507',
'javelin-behavior-differential-add-reviewers-and-ccs' => 'e10f8e18',
'javelin-behavior-differential-comment-jump' => '4fdb476d',
@@ -1226,6 +1226,11 @@
'javelin-util',
'phabricator-shaped-request',
),
+ '4c193c96' => array(
+ 'javelin-behavior',
+ 'javelin-uri',
+ 'phabricator-notification',
+ ),
'4e3e79a6' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1744,11 +1749,6 @@
'javelin-util',
'phabricator-busy',
),
- 'ae9f2ec9' => array(
- 'javelin-behavior',
- 'javelin-uri',
- 'phabricator-notification',
- ),
'b003d4fb' => array(
'javelin-behavior',
'javelin-stratcom',
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
@@ -74,12 +74,20 @@
->addCancelButton('/', pht('Done'));
}
+ // If we have a guess at the timezone from the client, select it as the
+ // default.
+ $guess = $request->getStr('guess');
+ if (empty($options[$guess])) {
+ $guess = 'ignore';
+ }
+
$form = id(new AphrontFormView())
->appendChild(
id(new AphrontFormSelectControl())
->setName('timezone')
->setLabel(pht('Timezone'))
- ->setOptions($options));
+ ->setOptions($options)
+ ->setValue($guess));
return $this->newDialog()
->setTitle(pht('Adjust Timezone'))
diff --git a/webroot/rsrc/js/core/behavior-detect-timezone.js b/webroot/rsrc/js/core/behavior-detect-timezone.js
--- a/webroot/rsrc/js/core/behavior-detect-timezone.js
+++ b/webroot/rsrc/js/core/behavior-detect-timezone.js
@@ -45,6 +45,18 @@
var uri = config.uri + offset + '/';
+ // Some browsers (notably, Chrome) expose an "Intl" API which gives us
+ // direct access to a timezone setting. If we are able to read this, use
+ // it to guess which timezone the user is in so we can prefill the
+ // dropdown.
+ try {
+ var guess = Intl.DateTimeFormat().resolvedOptions().timeZone;
+ uri = JX.$U(uri).setQueryParam('guess', guess);
+ } catch (error) {
+ // Ignore any errors here, we'll just make the user pick from the big
+ // list.
+ }
+
new JX.Workflow(uri)
.start();
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 2:21 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709901
Default Alt Text
D15962.id.diff (3 KB)
Attached To
Mode
D15962: When the JS "Intl" API is available, use it to guess the timezone
Attached
Detach File
Event Timeline
Log In to Comment