MCPcopy Index your code
hub / github.com/csev/py4e / Duration

Function Duration

code/gmane/Chart.bundle.js:3039–3072  ·  view source on GitHub ↗
(duration)

Source from the content-addressed store, hash-verified

3037 }
3038
3039 function Duration (duration) {
3040 var normalizedInput = normalizeObjectUnits(duration),
3041 years = normalizedInput.year || 0,
3042 quarters = normalizedInput.quarter || 0,
3043 months = normalizedInput.month || 0,
3044 weeks = normalizedInput.week || 0,
3045 days = normalizedInput.day || 0,
3046 hours = normalizedInput.hour || 0,
3047 minutes = normalizedInput.minute || 0,
3048 seconds = normalizedInput.second || 0,
3049 milliseconds = normalizedInput.millisecond || 0;
3050
3051 // representation for dateAddRemove
3052 this._milliseconds = +milliseconds +
3053 seconds * 1e3 + // 1000
3054 minutes * 6e4 + // 1000 * 60
3055 hours * 36e5; // 1000 * 60 * 60
3056 // Because of dateAddRemove treats 24 hours as different from a
3057 // day when working around DST, we need to store them separately
3058 this._days = +days +
3059 weeks * 7;
3060 // It is impossible translate months into days without knowing
3061 // which months you are are talking about, so we have to store
3062 // it separately.
3063 this._months = +months +
3064 quarters * 3 +
3065 years * 12;
3066
3067 this._data = {};
3068
3069 this._locale = locale_locales__getLocale();
3070
3071 this._bubble();
3072 }
3073
3074 function isDuration (obj) {
3075 return obj instanceof Duration;

Callers

nothing calls this directly

Calls 2

normalizeObjectUnitsFunction · 0.85

Tested by

no test coverage detected