From f1c00e18e6978cdab4a681179f632a0a4f173838 Mon Sep 17 00:00:00 2001 From: Iskren Chernev Date: Sat, 9 Nov 2013 09:17:31 -0800 Subject: [PATCH] Properly use global this to export moment This is one issue encountered in strict mode. Related to #1179 --- moment.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moment.js b/moment.js index ab52e62e2..3d7194001 100644 --- a/moment.js +++ b/moment.js @@ -12,6 +12,7 @@ var moment, VERSION = "2.4.0", + global = this, round = Math.round, i, @@ -2282,7 +2283,7 @@ // add `moment` as a global object via a string identifier, // for Closure Compiler "advanced" mode if (deprecate) { - this.moment = function () { + global.moment = function () { if (!warned && console && console.warn) { warned = true; console.warn( @@ -2293,7 +2294,7 @@ return local_moment.apply(null, arguments); }; } else { - this['moment'] = moment; + global['moment'] = moment; } } -- 2.47.2