{"action":"created","comment":{"url":"https://api.github.com/repos/tidepool-org/sundial/pulls/comments/37133663","id":37133663,"diff_hunk":"@@ -317,9 +307,82 @@ var datetimeWrapper = function(moment) {\n     /*\n      * Get all timezone objects\n      *\n-     * @return {Array} a list of available timezone objects\n+     * @return {Object} a hash of arrays of timezone objects\n+     * in convenient categories for displaying in a searchable dropdown\n      */\n     getTimezones: function() {\n+      var tzNames = moment.tz.names();\n+      var timezones = {\n+        // main timezones of the U.S. lower 48\n+        bigFour: [],\n+        // remainder of U.S. timezones\n+        unitedStates: [],\n+        // the English-speaking world + Europe\n+        hoisted: [],\n+        // everywhere else\n+        theRest: []\n+      };\n+      var big4 = {\n+        'US/Eastern': true,\n+        'US/Central': true,\n+        'US/Mountain': true,\n+        'US/Pacific': true\n+      };\n+      var newZealand = {\n+        'Pacific/Auckland': true,\n+        'Pacific/Chatham': true\n+      };\n+      var now = new Date().valueOf();\n+      for (var i = 0; i < tzNames.length; ++i) {\n+        var zone = moment.tz.zone(tzNames[i]);\n+        // we use the current epoch time to determine the current UTC\n+        // offset for each timezone (i.e., adjust for DST or not)\n+        // the offset is part of the `label` attribute\n+        var offsetInHours = moment.duration(zone.offset(now), 'minutes')\n+          .asMilliseconds()/(1000*60*60);\n+\n+        // because moment signs offsets the opposite way from the ISO 8601 standard\n+        // the standard is negative for N. American timezones\n+        // but moment (and JavaScript in general) represent them as positive\n+        var offsetAsString = offsetInHours > 0 ?\n+          '-' + offsetInHours : '+' + Math.abs(offsetInHours);\n+\n+        var timezone = {\n+          label: format('%s (UTC%s)', tzNames[i], offsetAsString),\n+          value: tzNames[i],\n+          offset: Number(offsetAsString)\n+        };\n+\n+        if (big4[tzNames[i]] === true) {\n+          timezones.bigFour.push(timezone);\n+        }\n+        else if (tzNames[i].search('US/') !== -1) {\n+          timezones.unitedStates.push(timezone);\n+        }\n+        else if (tzNames[i].search('Canada') !== -1) {","path":"lib/datetimeWrapper.js","position":83,"original_position":83,"commit_id":"6fbe5eb99531768594956cfb3566d6cf2d92c535","original_commit_id":"6fbe5eb99531768594956cfb3566d6cf2d92c535","user":{"login":"jebeck","id":1588547,"avatar_url":"https://avatars.githubusercontent.com/u/1588547?v=3","gravatar_id":"","url":"https://api.github.com/users/jebeck","html_url":"https://github.com/jebeck","followers_url":"https://api.github.com/users/jebeck/followers","following_url":"https://api.github.com/users/jebeck/following{/other_user}","gists_url":"https://api.github.com/users/jebeck/gists{/gist_id}","starred_url":"https://api.github.com/users/jebeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jebeck/subscriptions","organizations_url":"https://api.github.com/users/jebeck/orgs","repos_url":"https://api.github.com/users/jebeck/repos","events_url":"https://api.github.com/users/jebeck/events{/privacy}","received_events_url":"https://api.github.com/users/jebeck/received_events","type":"User","site_admin":false},"body":"Ah, good catch! Will do.","created_at":"2015-08-15T05:37:16Z","updated_at":"2015-08-15T05:37:16Z","html_url":"https://github.com/tidepool-org/sundial/pull/22#discussion_r37133663","pull_request_url":"https://api.github.com/repos/tidepool-org/sundial/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/sundial/pulls/comments/37133663"},"html":{"href":"https://github.com/tidepool-org/sundial/pull/22#discussion_r37133663"},"pull_request":{"href":"https://api.github.com/repos/tidepool-org/sundial/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/tidepool-org/sundial/pulls/22","id":42510978,"html_url":"https://github.com/tidepool-org/sundial/pull/22","diff_url":"https://github.com/tidepool-org/sundial/pull/22.diff","patch_url":"https://github.com/tidepool-org/sundial/pull/22.patch","issue_url":"https://api.github.com/repos/tidepool-org/sundial/issues/22","number":22,"state":"open","locked":false,"title":"new getTimezones function","user":{"login":"jebeck","id":1588547,"avatar_url":"https://avatars.githubusercontent.com/u/1588547?v=3","gravatar_id":"","url":"https://api.github.com/users/jebeck","html_url":"https://github.com/jebeck","followers_url":"https://api.github.com/users/jebeck/followers","following_url":"https://api.github.com/users/jebeck/following{/other_user}","gists_url":"https://api.github.com/users/jebeck/gists{/gist_id}","starred_url":"https://api.github.com/users/jebeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jebeck/subscriptions","organizations_url":"https://api.github.com/users/jebeck/orgs","repos_url":"https://api.github.com/users/jebeck/repos","events_url":"https://api.github.com/users/jebeck/events{/privacy}","received_events_url":"https://api.github.com/users/jebeck/received_events","type":"User","site_admin":false},"body":"Instead of the hard-coded list (with a data structure that didn't play well with the react-select component we're using in the uploader), we generate an object from the list of loaded moment timezones.\r\n\r\nThe object has a bunch of categories for easily grabbing subsets of timezones of interest - (1) just the four major U.S. timezones, (2) the remainder of the U.S. timezones, (3) all Canadian, European, Australian, and Kiwi timezones, and then (4) the rest of the world.\r\n\r\n","created_at":"2015-08-15T01:24:35Z","updated_at":"2015-08-15T05:37:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45f57e6099f676fd077b1a42f84630707c2ff0e1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tidepool-org/sundial/pulls/22/commits","review_comments_url":"https://api.github.com/repos/tidepool-org/sundial/pulls/22/comments","review_comment_url":"https://api.github.com/repos/tidepool-org/sundial/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidepool-org/sundial/issues/22/comments","statuses_url":"https://api.github.com/repos/tidepool-org/sundial/statuses/6fbe5eb99531768594956cfb3566d6cf2d92c535","head":{"label":"tidepool-org:jebeck/new-get-timezones","ref":"jebeck/new-get-timezones","sha":"6fbe5eb99531768594956cfb3566d6cf2d92c535","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":16211359,"name":"sundial","full_name":"tidepool-org/sundial","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/sundial","description":"Tidepool's datetime library helping us to deal with diabetes data and dates","fork":false,"url":"https://api.github.com/repos/tidepool-org/sundial","forks_url":"https://api.github.com/repos/tidepool-org/sundial/forks","keys_url":"https://api.github.com/repos/tidepool-org/sundial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/sundial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/sundial/teams","hooks_url":"https://api.github.com/repos/tidepool-org/sundial/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/sundial/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/sundial/events","assignees_url":"https://api.github.com/repos/tidepool-org/sundial/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/sundial/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/sundial/tags","blobs_url":"https://api.github.com/repos/tidepool-org/sundial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/sundial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/sundial/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/sundial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/sundial/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/sundial/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/sundial/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/sundial/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/sundial/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/sundial/subscription","commits_url":"https://api.github.com/repos/tidepool-org/sundial/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/sundial/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/sundial/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/sundial/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/sundial/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/sundial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/sundial/merges","archive_url":"https://api.github.com/repos/tidepool-org/sundial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/sundial/downloads","issues_url":"https://api.github.com/repos/tidepool-org/sundial/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/sundial/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/sundial/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/sundial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/sundial/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/sundial/releases{/id}","created_at":"2014-01-24T17:23:55Z","updated_at":"2015-04-15T23:49:36Z","pushed_at":"2015-08-15T01:24:35Z","git_url":"git://github.com/tidepool-org/sundial.git","ssh_url":"git@github.com:tidepool-org/sundial.git","clone_url":"https://github.com/tidepool-org/sundial.git","svn_url":"https://github.com/tidepool-org/sundial","homepage":"","size":647,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"tidepool-org:master","ref":"master","sha":"26cf836dbd1fba10948605afdb4d8427ca12541d","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":16211359,"name":"sundial","full_name":"tidepool-org/sundial","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/sundial","description":"Tidepool's datetime library helping us to deal with diabetes data and dates","fork":false,"url":"https://api.github.com/repos/tidepool-org/sundial","forks_url":"https://api.github.com/repos/tidepool-org/sundial/forks","keys_url":"https://api.github.com/repos/tidepool-org/sundial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/sundial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/sundial/teams","hooks_url":"https://api.github.com/repos/tidepool-org/sundial/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/sundial/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/sundial/events","assignees_url":"https://api.github.com/repos/tidepool-org/sundial/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/sundial/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/sundial/tags","blobs_url":"https://api.github.com/repos/tidepool-org/sundial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/sundial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/sundial/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/sundial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/sundial/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/sundial/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/sundial/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/sundial/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/sundial/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/sundial/subscription","commits_url":"https://api.github.com/repos/tidepool-org/sundial/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/sundial/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/sundial/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/sundial/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/sundial/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/sundial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/sundial/merges","archive_url":"https://api.github.com/repos/tidepool-org/sundial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/sundial/downloads","issues_url":"https://api.github.com/repos/tidepool-org/sundial/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/sundial/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/sundial/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/sundial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/sundial/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/sundial/releases{/id}","created_at":"2014-01-24T17:23:55Z","updated_at":"2015-04-15T23:49:36Z","pushed_at":"2015-08-15T01:24:35Z","git_url":"git://github.com/tidepool-org/sundial.git","ssh_url":"git@github.com:tidepool-org/sundial.git","clone_url":"https://github.com/tidepool-org/sundial.git","svn_url":"https://github.com/tidepool-org/sundial","homepage":"","size":647,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/sundial/pulls/22"},"html":{"href":"https://github.com/tidepool-org/sundial/pull/22"},"issue":{"href":"https://api.github.com/repos/tidepool-org/sundial/issues/22"},"comments":{"href":"https://api.github.com/repos/tidepool-org/sundial/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/tidepool-org/sundial/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/tidepool-org/sundial/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidepool-org/sundial/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/tidepool-org/sundial/statuses/6fbe5eb99531768594956cfb3566d6cf2d92c535"}}}}