registration

This commit is contained in:
User
2025-02-02 16:08:03 +03:00
parent 7f6495eb4d
commit 78afbaed71
6334 changed files with 196774 additions and 165754 deletions

View File

@@ -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;