From: Jan Dudek Date: Wed, 20 Feb 2013 21:43:30 +0000 (+0100) Subject: Fixed incorrect result of toJSON for dates with timezone other than UTC X-Git-Tag: 2.1.0~57^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=729de9ba124bd040b5fb720430f37c2e06ec184b;p=thirdparty%2Fmoment.git Fixed incorrect result of toJSON for dates with timezone other than UTC --- diff --git a/moment.js b/moment.js index 08f76d6df..12b2794a4 100644 --- a/moment.js +++ b/moment.js @@ -1059,7 +1059,7 @@ }, toJSON : function () { - return moment.utc(this).format('YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); + return this.utc().format('YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); }, toArray : function () { diff --git a/test/moment/format.js b/test/moment/format.js index c26613dfe..b0d857c1a 100644 --- a/test/moment/format.js +++ b/test/moment/format.js @@ -140,7 +140,7 @@ exports.format = { "toJSON" : function(test) { var supportsJson = typeof JSON !== "undefined" && JSON.stringify && JSON.stringify.call, - date = moment.utc("2012-10-09T20:30:40.678"); + date = moment("2012-10-09T21:30:40.678+0100"); test.expect(supportsJson ? 2 : 1);