registration
This commit is contained in:
23
frontend/style/node_modules/date-fns/milliseconds.js
generated
vendored
23
frontend/style/node_modules/date-fns/milliseconds.js
generated
vendored
@@ -1,6 +1,4 @@
|
||||
"use strict";
|
||||
exports.milliseconds = milliseconds;
|
||||
var _index = require("./constants.js");
|
||||
import { daysInYear } from "./constants.js";
|
||||
|
||||
/**
|
||||
* @name milliseconds
|
||||
@@ -13,7 +11,7 @@ var _index = require("./constants.js");
|
||||
*
|
||||
* One years equals 365.2425 days according to the formula:
|
||||
*
|
||||
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
|
||||
* > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.
|
||||
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
||||
*
|
||||
* One month is a year divided by 12.
|
||||
@@ -31,11 +29,19 @@ var _index = require("./constants.js");
|
||||
* milliseconds({ months: 3 })
|
||||
* //=> 7889238000
|
||||
*/
|
||||
function milliseconds({ years, months, weeks, days, hours, minutes, seconds }) {
|
||||
export function milliseconds({
|
||||
years,
|
||||
months,
|
||||
weeks,
|
||||
days,
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
}) {
|
||||
let totalDays = 0;
|
||||
|
||||
if (years) totalDays += years * _index.daysInYear;
|
||||
if (months) totalDays += months * (_index.daysInYear / 12);
|
||||
if (years) totalDays += years * daysInYear;
|
||||
if (months) totalDays += months * (daysInYear / 12);
|
||||
if (weeks) totalDays += weeks * 7;
|
||||
if (days) totalDays += days;
|
||||
|
||||
@@ -47,3 +53,6 @@ function milliseconds({ years, months, weeks, days, hours, minutes, seconds }) {
|
||||
|
||||
return Math.trunc(totalSeconds * 1000);
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default milliseconds;
|
||||
|
||||
Reference in New Issue
Block a user