Merge pull request #6706 from FreeCodeCamp/fix/patch-guess
Fix catch timezone bug
This commit is contained in:
@ -3,7 +3,7 @@ window.common = (function(global) {
|
|||||||
$,
|
$,
|
||||||
moment,
|
moment,
|
||||||
ga = (() => {}),
|
ga = (() => {}),
|
||||||
common = { init: [] }
|
common = { init: [] }
|
||||||
} = global;
|
} = global;
|
||||||
|
|
||||||
common.showCompletion = function showCompletion() {
|
common.showCompletion = function showCompletion() {
|
||||||
@ -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) {
|
||||||
|
Reference in New Issue
Block a user