]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fixed incorrect result of toJSON for dates with timezone other than UTC
authorJan Dudek <jd@jandudek.com>
Wed, 20 Feb 2013 21:43:30 +0000 (22:43 +0100)
committerJan Dudek <jd@jandudek.com>
Wed, 20 Feb 2013 21:43:30 +0000 (22:43 +0100)
moment.js
test/moment/format.js

index 08f76d6df49b34aacfe383cd21f4c2acdb3e65bf..12b2794a4e7ca5084fc97e289521016478004ecc 100644 (file)
--- a/moment.js
+++ b/moment.js
         },
 
         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 () {
index c26613dfe72b9627eceea221c2bf7399bc719bf2..b0d857c1acc4e9bb43bc457bc46dfac6ff5e1211 100644 (file)
@@ -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);