From 425d0d1e2e1901e699872978301b433ab74c2f42 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Wed, 3 Feb 2016 11:33:30 -0800 Subject: [PATCH] Fix catch timezone bug see https://github.com/moment/moment-timezone/issues/294 --- client/commonFramework/show-completion.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/commonFramework/show-completion.js b/client/commonFramework/show-completion.js index ce1263850f..f579f4626d 100644 --- a/client/commonFramework/show-completion.js +++ b/client/commonFramework/show-completion.js @@ -3,7 +3,7 @@ window.common = (function(global) { $, moment, ga = (() => {}), - common = { init: [] } + common = { init: [] } } = global; common.showCompletion = function showCompletion() { @@ -47,13 +47,23 @@ window.common = (function(global) { next(); }); + let timezone = 'UTC'; + try { + timezone = moment.tz.guess(); + } catch (err) { + err.message = ` + known bug, see: https://github.com/moment/moment-timezone/issues/294: + ${err.message} + `; + console.error(err); + } const data = { id: common.challengeId, name: common.challengeName, completedWith: didCompleteWith, challengeType: common.challengeType, solution, - timezone: moment.tz.guess() + timezone }; $.post('/completed-challenge/', data, function(res) {