Yeah, it's ugly, but it will be deprecated in 1.7.0 anyway…
#299
// This method is deprecated in favor of the new Duration object. Please
// see the moment.duration method.
moment.humanizeDuration = function (num, type, withSuffix) {
- return moment.duration(num, type).humanize(withSuffix);
+ return moment.duration(num, type === true ? null : type).humanize(type === true ? true : withSuffix);
};
// version number
},
"humanize duration with suffix" : function(test) {
- test.expect(2);
+ test.expect(3);
moment.lang('en');
test.equal(moment.humanizeDuration(44, "seconds", true), "in a few seconds", "44 seconds = a few seconds");
test.equal(moment.humanizeDuration(-44, "seconds", true), "a few seconds ago", "44 seconds = a few seconds");
+ test.equal(moment.humanizeDuration(44000, true), "in a few seconds", "44000 milliseconds = a few seconds");
test.done();
}
};