Merge pull request #6706 from FreeCodeCamp/fix/patch-guess

Fix catch timezone bug
This commit is contained in:
Rex Schrader
2016-02-03 11:56:07 -08:00

View File

@ -47,13 +47,23 @@ window.common = (function(global) {
next(); 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 = { const data = {
id: common.challengeId, id: common.challengeId,
name: common.challengeName, name: common.challengeName,
completedWith: didCompleteWith, completedWith: didCompleteWith,
challengeType: common.challengeType, challengeType: common.challengeType,
solution, solution,
timezone: moment.tz.guess() timezone
}; };
$.post('/completed-challenge/', data, function(res) { $.post('/completed-challenge/', data, function(res) {