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,8 +1,6 @@
"use strict";
exports.differenceInHours = differenceInHours;
var _index = require("./_lib/getRoundingMethod.js");
var _index2 = require("./constants.js");
var _index3 = require("./differenceInMilliseconds.js");
import { getRoundingMethod } from "./_lib/getRoundingMethod.js";
import { normalizeDates } from "./_lib/normalizeDates.js";
import { millisecondsInHour } from "./constants.js";
/**
* The {@link differenceInHours} function options.
@@ -16,10 +14,8 @@ var _index3 = require("./differenceInMilliseconds.js");
* @description
* Get the number of hours between the given dates.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param dateLeft - The later date
* @param dateRight - The earlier date
* @param laterDate - The later date
* @param earlierDate - The earlier date
* @param options - An object with options.
*
* @returns The number of hours
@@ -32,9 +28,15 @@ var _index3 = require("./differenceInMilliseconds.js");
* )
* //=> 12
*/
function differenceInHours(dateLeft, dateRight, options) {
const diff =
(0, _index3.differenceInMilliseconds)(dateLeft, dateRight) /
_index2.millisecondsInHour;
return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff);
export function differenceInHours(laterDate, earlierDate, options) {
const [laterDate_, earlierDate_] = normalizeDates(
options?.in,
laterDate,
earlierDate,
);
const diff = (+laterDate_ - +earlierDate_) / millisecondsInHour;
return getRoundingMethod(options?.roundingMethod)(diff);
}
// Fallback for modularized imports:
export default differenceInHours;