This is actually fixing #475 -- toString on utc moments was returning
localized format. This commit fixes the issue and also makes sure that
toString will work uniformly on all browsers from now on.
},
toString : function () {
- return this._d.toString();
+ return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
},
toDate : function () {
test.done();
},
- "string from Date.toString" : function(test) {
- test.expect(1);
- var str = (new Date()).toString();
- test.equal(moment(str).toString(), str, "Parsing a string from Date.prototype.toString should match moment.fn.toString");
- test.done();
- },
-
"string without format - json" : function(test) {
test.expect(5);
test.equal(moment("Date(1325132654000)").valueOf(), 1325132654000, "Date(1325132654000)");
test.equal(iso, the, i + ": should be " + iso + ", but " + the);
}
+ test.done();
+ },
+
+ "toString is just human readable format" : function(test) {
+ test.expect(1);
+
+ var b = moment(new Date(2009, 1, 5, 15, 25, 50, 125));
+ test.equal(b.toString(), b.format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'));
test.done();
}
};