Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 3bdc86e

Browse files
committed
Merge pull request #1368 from rmisio/timezone-tweaks
Timezone tweaks
2 parents bcc2f4e + 25d2fd1 commit 3bdc86e

File tree

4 files changed

+51
-189
lines changed

4 files changed

+51
-189
lines changed

js/languages/en-US.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,5 +673,38 @@
673673
"restoreDefaults": "Restore defaults",
674674
"saveChanges": "Save Changes",
675675
"retry": "Retry connection"
676+
},
677+
"timezones": {
678+
"-12": "(GMT -12:00) Eniwetok, Kwajalein",
679+
"-11": "(GMT -11:00) Midway Island, Samoa",
680+
"-10": "(GMT -10:00) Hawaii",
681+
"-9": "(GMT -9:00) Alaska",
682+
"-8": "(GMT -8:00) Pacific Time (US & Canada)",
683+
"-7": "(GMT -7:00) Mountain Time (US & Canada)",
684+
"-6": "(GMT -6:00) Central Time (US & Canada), Mexico City",
685+
"-5": "(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima",
686+
"-4": "(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz",
687+
"-3.5": "(GMT -3:30) Newfoundland",
688+
"-3": "(GMT -3:00) Brazil, Buenos Aires, Georgetown",
689+
"-2": "(GMT -2:00) Mid-Atlantic",
690+
"-1": "(GMT -1:00) Azores, Cape Verde Islands",
691+
"0": "(GMT) Western Europe Time, London, Lisbon, Casablanca",
692+
"1": "(GMT +1:00) Brussels, Copenhagen, Madrid, Paris",
693+
"2": "(GMT +2:00) Kaliningrad, South Africa",
694+
"3": "(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg",
695+
"3.5": "(GMT +3:30) Tehran",
696+
"4": "(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi",
697+
"4.5": "(GMT +4:30) Kabul",
698+
"5": "(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent",
699+
"5.5": "(GMT +5:30) Bombay, Calcutta, Madras, New Delhi",
700+
"5.75": "(GMT +5:45) Kathmandu",
701+
"6": "(GMT +6:00) Almaty, Dhaka, Colombo",
702+
"7": "(GMT +7:00) Bangkok, Hanoi, Jakarta",
703+
"8": "(GMT +8:00) Beijing, Perth, Singapore, Hong Kong",
704+
"9": "(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk",
705+
"9.5": "(GMT +9:30) Adelaide, Darwin",
706+
"10": "(GMT +10:00) Eastern Australia, Guam, Vladivostok",
707+
"11": "(GMT +11:00) Magadan, Solomon Islands, New Caledonia",
708+
"12": "(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka"
676709
}
677710
}

js/templates/onboardingModal.html

Lines changed: 8 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -109,192 +109,14 @@
109109
</div>
110110
</div>
111111
<ul class="flexRow list js-homeModal-listParent js-homeModal-timeZoneList homeModal-settings scrollOverflowY custCol-primary custCol-text customThemeScrollbar">
112-
<li class="flexRow custCol-border">
113-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
114-
<input type="radio" class="fieldItem" id="(GMT -12:00) Eniwetok, Kwajalein" name="time_zone" value="-12">
115-
<label class="homeModal-time radioLabel" for="(GMT -12:00) Eniwetok, Kwajalein">(GMT -12:00) Eniwetok, Kwajalein</label>
116-
</div>
117-
</li>
118-
<li class="flexRow custCol-border">
119-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
120-
<input type="radio" class="fieldItem" id="(GMT -11:00) Midway Island, Samoa" name="time_zone" value="-11">
121-
<label class="homeModal-time radioLabel" for="(GMT -11:00) Midway Island, Samoa">(GMT -11:00) Midway Island, Samoa</label>
122-
</div>
123-
</li>
124-
<li class="flexRow custCol-border">
125-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
126-
<input type="radio" class="fieldItem" id="(GMT -10:00) Hawaii" name="time_zone" value="-10">
127-
<label class="homeModal-time radioLabel" for="(GMT -10:00) Hawaii">(GMT -10:00) Hawaii</label>
128-
</div>
129-
</li>
130-
<li class="flexRow custCol-border">
131-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
132-
<input type="radio" class="fieldItem" id="(GMT -9:00) Alaska" name="time_zone" value="-9">
133-
<label class="homeModal-time radioLabel" for="(GMT -9:00) Alaska">(GMT -9:00) Alaska</label>
134-
</div>
135-
</li>
136-
<li class="flexRow custCol-border">
137-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
138-
<input type="radio" class="fieldItem" id="(GMT -8:00) Pacific Time (US &amp; Canada)" name="time_zone" value="-8">
139-
<label class="homeModal-time radioLabel" for="(GMT -8:00) Pacific Time (US &amp; Canada)">(GMT -8:00) Pacific Time (US &amp; Canada)</label>
140-
</div>
141-
</li>
142-
<li class="flexRow custCol-border">
143-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
144-
<input type="radio" class="fieldItem" id="(GMT -7:00) Mountain Time (US &amp; Canada)" name="time_zone" value="-7">
145-
<label class="homeModal-time radioLabel" for="(GMT -7:00) Mountain Time (US &amp; Canada)">(GMT -7:00) Mountain Time (US &amp; Canada)</label>
146-
</div>
147-
</li>
148-
<li class="flexRow custCol-border">
149-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
150-
<input type="radio" class="fieldItem" id="(GMT -6:00) Central Time (US &amp; Canada), Mexico City" name="time_zone" value="-6">
151-
<label class="homeModal-time radioLabel" for="(GMT -6:00) Central Time (US &amp; Canada), Mexico City">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</label>
152-
</div>
153-
</li>
154-
<li class="flexRow custCol-border">
155-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
156-
<input type="radio" class="fieldItem" id="(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima" name="time_zone" value="-5">
157-
<label class="homeModal-time radioLabel" for="(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</label>
158-
</div>
159-
</li>
160-
<li class="flexRow custCol-border">
161-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
162-
<input type="radio" class="fieldItem" id="(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz" name="time_zone" value="-4">
163-
<label class="homeModal-time radioLabel" for="(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz">(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</label>
164-
</div>
165-
</li>
166-
<li class="flexRow custCol-border">
167-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
168-
<input type="radio" class="fieldItem" id="(GMT -3:30) Newfoundland" name="time_zone" value="-3.5">
169-
<label class="homeModal-time radioLabel" for="(GMT -3:30) Newfoundland">(GMT -3:30) Newfoundland</label>
170-
</div>
171-
</li>
172-
<li class="flexRow custCol-border">
173-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
174-
<input type="radio" class="fieldItem" id="(GMT -3:00) Brazil, Buenos Aires, Georgetown" name="time_zone" value="-3">
175-
<label class="homeModal-time radioLabel" for="(GMT -3:00) Brazil, Buenos Aires, Georgetown">(GMT -3:00) Brazil, Buenos Aires, Georgetown</label>
176-
</div>
177-
</li>
178-
<li class="flexRow custCol-border">
179-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
180-
<input type="radio" class="fieldItem" id="(GMT -2:00) Mid-Atlantic" name="time_zone" value="-2">
181-
<label class="homeModal-time radioLabel" for="(GMT -2:00) Mid-Atlantic">(GMT -2:00) Mid-Atlantic</label>
182-
</div>
183-
</li>
184-
<li class="flexRow custCol-border">
185-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
186-
<input type="radio" class="fieldItem" id="(GMT -1:00 hour) Azores, Cape Verde Islands" name="time_zone" value="-1">
187-
<label class="homeModal-time radioLabel" for="(GMT -1:00 hour) Azores, Cape Verde Islands">(GMT -1:00 hour) Azores, Cape Verde Islands</label>
188-
</div>
189-
</li>
190-
<li class="flexRow custCol-border">
191-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
192-
<input type="radio" class="fieldItem" id="(GMT) Western Europe Time, London, Lisbon, Casablanca" name="time_zone" value="0">
193-
<label class="homeModal-time radioLabel" for="(GMT) Western Europe Time, London, Lisbon, Casablanca">(GMT) Western Europe Time, London, Lisbon, Casablanca</label>
194-
</div>
195-
</li>
196-
<li class="flexRow custCol-border">
197-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
198-
<input type="radio" class="fieldItem" id="(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris" name="time_zone" value="1">
199-
<label class="homeModal-time radioLabel" for="(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris">(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</label>
200-
</div>
201-
</li>
202-
<li class="flexRow custCol-border">
203-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
204-
<input type="radio" class="fieldItem" id="(GMT +2:00) Kaliningrad, South Africa" name="time_zone" value="2">
205-
<label class="homeModal-time radioLabel" for="(GMT +2:00) Kaliningrad, South Africa">(GMT +2:00) Kaliningrad, South Africa</label>
206-
</div>
207-
</li>
208-
<li class="flexRow custCol-border">
209-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
210-
<input type="radio" class="fieldItem" id="(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg" name="time_zone" value="3">
211-
<label class="homeModal-time radioLabel" for="(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg">(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</label>
212-
</div>
213-
</li>
214-
<li class="flexRow custCol-border">
215-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
216-
<input type="radio" class="fieldItem" id="(GMT +3:30) Tehran" name="time_zone" value="3.5">
217-
<label class="homeModal-time radioLabel" for="(GMT +3:30) Tehran">(GMT +3:30) Tehran</label>
218-
</div>
219-
</li>
220-
<li class="flexRow custCol-border">
221-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
222-
<input type="radio" class="fieldItem" id="(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi" name="time_zone" value="4">
223-
<label class="homeModal-time radioLabel" for="(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi">(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</label>
224-
</div>
225-
</li>
226-
<li class="flexRow custCol-border">
227-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
228-
<input type="radio" class="fieldItem" id="(GMT +4:30) Kabul" name="time_zone" value="4.5">
229-
<label class="homeModal-time radioLabel" for="(GMT +4:30) Kabul">(GMT +4:30) Kabul</label>
230-
</div>
231-
</li>
232-
<li class="flexRow custCol-border">
233-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
234-
<input type="radio" class="fieldItem" id="(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent" name="time_zone" value="5">
235-
<label class="homeModal-time radioLabel" for="(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent">(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</label>
236-
</div>
237-
</li>
238-
<li class="flexRow custCol-border">
239-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
240-
<input type="radio" class="fieldItem" id="(GMT +5:30) Bombay, Calcutta, Madras, New Delhi" name="time_zone" value="5.5">
241-
<label class="homeModal-time radioLabel" for="(GMT +5:30) Bombay, Calcutta, Madras, New Delhi">(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</label>
242-
</div>
243-
</li>
244-
<li class="flexRow custCol-border">
245-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
246-
<input type="radio" class="fieldItem" id="(GMT +5:45) Kathmandu" name="time_zone" value="5.75">
247-
<label class="homeModal-time radioLabel" for="(GMT +5:45) Kathmandu">(GMT +5:45) Kathmandu</label>
248-
</div>
249-
</li>
250-
<li class="flexRow custCol-border">
251-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
252-
<input type="radio" class="fieldItem" id="(GMT +6:00) Almaty, Dhaka, Colombo" name="time_zone" value="6">
253-
<label class="homeModal-time radioLabel" for="(GMT +6:00) Almaty, Dhaka, Colombo">(GMT +6:00) Almaty, Dhaka, Colombo</label>
254-
</div>
255-
</li>
256-
<li class="flexRow custCol-border">
257-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
258-
<input type="radio" class="fieldItem" id="(GMT +7:00) Bangkok, Hanoi, Jakarta" name="time_zone" value="7">
259-
<label class="homeModal-time radioLabel" for="(GMT +7:00) Bangkok, Hanoi, Jakarta">(GMT +7:00) Bangkok, Hanoi, Jakarta</label>
260-
</div>
261-
</li>
262-
<li class="flexRow custCol-border">
263-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
264-
<input type="radio" class="fieldItem" id="(GMT +8:00) Beijing, Perth, Singapore, Hong Kong" name="time_zone" value="8">
265-
<label class="homeModal-time radioLabel" for="(GMT +8:00) Beijing, Perth, Singapore, Hong Kong">(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</label>
266-
</div>
267-
</li>
268-
<li class="flexRow custCol-border">
269-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
270-
<input type="radio" class="fieldItem" id="(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk" name="time_zone" value="9">
271-
<label class="homeModal-time radioLabel" for="(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk">(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</label>
272-
</div>
273-
</li>
274-
<li class="flexRow custCol-border">
275-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
276-
<input type="radio" class="fieldItem" id="(GMT +9:30) Adelaide, Darwin" name="time_zone" value="9.5">
277-
<label class="homeModal-time radioLabel" for="(GMT +9:30) Adelaide, Darwin">(GMT +9:30) Adelaide, Darwin</label>
278-
</div>
279-
</li>
280-
<li class="flexRow custCol-border">
281-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
282-
<input type="radio" class="fieldItem" id="(GMT +10:00) Eastern Australia, Guam, Vladivostok" name="time_zone" value="10">
283-
<label class="homeModal-time radioLabel" for="(GMT +10:00) Eastern Australia, Guam, Vladivostok">(GMT +10:00) Eastern Australia, Guam, Vladivostok</label>
284-
</div>
285-
</li>
286-
<li class="flexRow custCol-border">
287-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
288-
<input type="radio" class="fieldItem" id="(GMT +11:00) Magadan, Solomon Islands, New Caledonia" name="time_zone" value="10">
289-
<label class="homeModal-time radioLabel" for="(GMT +11:00) Magadan, Solomon Islands, New Caledonia">(GMT +11:00) Magadan, Solomon Islands, New Caledonia</label>
290-
</div>
291-
</li>
292-
<li class="flexRow custCol-border">
293-
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
294-
<input type="radio" class="fieldItem" id="(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka" name="time_zone" value="12">
295-
<label class="homeModal-time radioLabel" for="(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka">(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</label>
296-
</div>
297-
</li>
112+
<% ob.timezones.forEach((tz) => { %>
113+
<li class="flexRow custCol-border">
114+
<div class="rowItem js-homeModal-timeSelect paddingLeft6">
115+
<input type="radio" class="fieldItem" id="<%= tz.name %>" name="time_zone" value="<%= tz.offset %>">
116+
<label class="homeModal-time radioLabel" for="<%= tz.name %>"><%= polyglot.t('timezones.' + tz.offset) %></label>
117+
</div>
118+
</li>
119+
<% }) %>
298120
</ul>
299121
</div>
300122
<div class="bar barFlush borderBottomLeftRaidus3 borderBottomRightRaidus3">

js/views/onboardingModal.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
var Backbone = require('backbone'),
44
loadTemplate = require('../utils/loadTemplate'),
5+
moment = require('moment'),
56
cropit = require('../utils/jquery.cropit'),
67
app = require('../App').getApp(),
78
baseModal = require('./baseModal'),
9+
timezonesModel = require('../models/timezonesMd'),
810
languagesModel = require('../models/languagesMd'),
911
countryListView = require('../views/countryListVw'),
1012
currencyListView = require('../views/currencyListVw'),
@@ -42,6 +44,7 @@ module.exports = baseModal.extend({
4244
this.$el.attr('tabIndex', 0);
4345
this.$loadingModal = $('.js-loadingModal');
4446
this.languages = new languagesModel();
47+
this.timezones = new timezonesModel();
4548

4649
// pre-select lauguage.
4750
var localLanguage = window.navigator.language;
@@ -572,13 +575,17 @@ module.exports = baseModal.extend({
572575
var timeZoneOffset,
573576
$themeInputs;
574577

575-
self.$el.html(t());
578+
self.$el.html(t({
579+
timezones: self.timezones.toJSON().timezones
580+
}));
576581

577582
baseModal.prototype.render.apply(self, arguments);
578583

579584
// pre-select timezone
580585
var timeZoneOffset = new Date().getTimezoneOffset();
581-
timeZoneOffset = '(GMT ' + (timeZoneOffset < 0 ? '+' : '-') + parseInt(Math.abs(timeZoneOffset/60)) + ':00)';
586+
timeZoneOffset = parseInt(Math.abs(timeZoneOffset/60));
587+
timeZoneOffset = moment().isDST() ? timeZoneOffset + 1 : timeZoneOffset;
588+
timeZoneOffset = '(GMT ' + (timeZoneOffset < 0 ? '+' : '-') + timeZoneOffset + ':00)';
582589
var selectedTimeZone = self.$("[id*='" + timeZoneOffset + "']");
583590
selectedTimeZone.prop('checked', true);
584591
self.model.set('time_zone', selectedTimeZone.val());

js/views/settingsVw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ module.exports = Backbone.View.extend({
406406
});
407407

408408
__.each(timezoneList, function(t, i){
409-
var timezone_option = $('<option value="'+t.offset+'">'+t.name+'</option>');
409+
var timezone_option = $('<option value="'+t.offset+'">'+ polyglot.t('timezones.' + t.offset) + '</option>');
410410
timezone_option.attr("selected",user.time_zone == t.offset);
411411
timezone_str += timezone_option[0].outerHTML;
412412
});

0 commit comments

Comments
 (0)