Skip to content

Commit

Permalink
Merge pull request #22 from Wilfred/local_timezone_by_default
Browse files Browse the repository at this point in the history
Use the browser's timezone by default
  • Loading branch information
StevenGBrown authored May 9, 2018
2 parents d8892c1 + b403d8e commit 5299d49
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,23 @@ function init() {
};

// Set the mode from a cookie or initialize it (also handle migrating old cookie values to new ones).
var mode = getCookie() || 'system';
var mode = getCookie();
if (mode) {
setCookie(mode);
} else {
// Initialize the cookie, defaulting to clock time in the browser's timezone.
mode = 'system';

setCookie(mode);
setCookie('true', 'local');
}

if (mode == 'local') {
options[mode].checked = true;
mode = 'system';
}
modes[mode].checked = true;

// Renew the cookie.
setCookie(mode);

// Set the click handler.
for (mode in modes) {
modes[mode].observe('click', function() {
Expand Down

0 comments on commit 5299d49

Please sign in to comment.