49 lines
3.4 KiB
JavaScript
49 lines
3.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getMilliSecondsFromUnits = exports.units = void 0;
|
|
exports.units = {
|
|
years: (timesArg = 1) => {
|
|
return timesArg * 3.154e10;
|
|
},
|
|
months: (timesArg = 1) => {
|
|
return timesArg * 2.628e9;
|
|
},
|
|
weeks: (timesArg = 1) => {
|
|
return timesArg * 6.048e8;
|
|
},
|
|
days: (timesArg = 1) => {
|
|
return timesArg * 8.64e7;
|
|
},
|
|
hours: (timesArg = 1) => {
|
|
return timesArg * 3.6e6;
|
|
},
|
|
minutes: (timesArg = 1) => {
|
|
return timesArg * 60000;
|
|
}
|
|
};
|
|
exports.getMilliSecondsFromUnits = (combinationArg) => {
|
|
let timeInMilliseconds = 0;
|
|
let addMilliSeconds = milliSecondsArg => {
|
|
timeInMilliseconds = timeInMilliseconds + milliSecondsArg;
|
|
};
|
|
if (combinationArg.years) {
|
|
addMilliSeconds(exports.units.years(combinationArg.years));
|
|
}
|
|
if (combinationArg.months) {
|
|
addMilliSeconds(exports.units.months(combinationArg.months));
|
|
}
|
|
if (combinationArg.weeks) {
|
|
addMilliSeconds(exports.units.weeks(combinationArg.weeks));
|
|
}
|
|
if (combinationArg.days) {
|
|
addMilliSeconds(exports.units.days(combinationArg.days));
|
|
}
|
|
if (combinationArg.hours) {
|
|
addMilliSeconds(exports.units.hours(combinationArg.hours));
|
|
}
|
|
if (combinationArg.minutes) {
|
|
addMilliSeconds(exports.units.minutes(combinationArg.minutes));
|
|
}
|
|
return timeInMilliseconds;
|
|
};
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnVuaXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLnVuaXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFXLFFBQUEs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