return this.localeData().invalidDate();
}
- var seconds = abs(this._milliseconds) / 1000;
+ var milliseconds = abs(this._milliseconds);
+ var seconds = absFloor(milliseconds / 1000);
var days = abs(this._days);
var months = abs(this._months);
var minutes, hours, years;
minutes = absFloor(seconds / 60);
hours = absFloor(minutes / 60);
seconds %= 60;
+ seconds += (milliseconds % 1000) / 1000;
minutes %= 60;
// 12 months -> 1 year
assert.equal(moment.duration({y: +1, M: 1}).toISOString(), 'P1Y1M', 'a month after a year in future');
assert.equal(moment.duration({}).toISOString(), 'P0D', 'zero duration');
assert.equal(moment.duration({M: 16, d:40, s: 86465}).toISOString(), 'P1Y4M40DT24H1M5S', 'all fields');
+ assert.equal(moment.duration({ms: 123456789}).toISOString(), 'PT34H17M36.789S', 'check floating-point errors');
});
test('toString acts as toISOString', function (assert) {