(duration)
| 17456 | } |
| 17457 | |
| 17458 | function Duration (duration) { |
| 17459 | var normalizedInput = normalizeObjectUnits(duration), |
| 17460 | years = normalizedInput.year || 0, |
| 17461 | quarters = normalizedInput.quarter || 0, |
| 17462 | months = normalizedInput.month || 0, |
| 17463 | weeks = normalizedInput.week || normalizedInput.isoWeek || 0, |
| 17464 | days = normalizedInput.day || 0, |
| 17465 | hours = normalizedInput.hour || 0, |
| 17466 | minutes = normalizedInput.minute || 0, |
| 17467 | seconds = normalizedInput.second || 0, |
| 17468 | milliseconds = normalizedInput.millisecond || 0; |
| 17469 | |
| 17470 | this._isValid = isDurationValid(normalizedInput); |
| 17471 | |
| 17472 | // representation for dateAddRemove |
| 17473 | this._milliseconds = +milliseconds + |
| 17474 | seconds * 1e3 + // 1000 |
| 17475 | minutes * 6e4 + // 1000 * 60 |
| 17476 | hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 |
| 17477 | // Because of dateAddRemove treats 24 hours as different from a |
| 17478 | // day when working around DST, we need to store them separately |
| 17479 | this._days = +days + |
| 17480 | weeks * 7; |
| 17481 | // It is impossible to translate months into days without knowing |
| 17482 | // which months you are are talking about, so we have to store |
| 17483 | // it separately. |
| 17484 | this._months = +months + |
| 17485 | quarters * 3 + |
| 17486 | years * 12; |
| 17487 | |
| 17488 | this._data = {}; |
| 17489 | |
| 17490 | this._locale = getLocale(); |
| 17491 | |
| 17492 | this._bubble(); |
| 17493 | } |
| 17494 | |
| 17495 | function isDuration (obj) { |
| 17496 | return obj instanceof Duration; |
nothing calls this directly
no test coverage detected