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,9 @@
"use strict";
exports.isSameHour = isSameHour;
var _index = require("./startOfHour.js");
import { normalizeDates } from "./_lib/normalizeDates.js";
import { startOfHour } from "./startOfHour.js";
/**
* The {@link isSameHour} function options.
*/
/**
* @name isSameHour
@@ -10,10 +13,9 @@ var _index = require("./startOfHour.js");
* @description
* Are the given dates in the same hour (and same day)?
*
* @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 first date to check
* @param dateRight - The second date to check
* @param options - An object with options
*
* @returns The dates are in the same hour (and same day)
*
@@ -27,9 +29,14 @@ var _index = require("./startOfHour.js");
* const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 5, 6, 0))
* //=> false
*/
function isSameHour(dateLeft, dateRight) {
const dateLeftStartOfHour = (0, _index.startOfHour)(dateLeft);
const dateRightStartOfHour = (0, _index.startOfHour)(dateRight);
return +dateLeftStartOfHour === +dateRightStartOfHour;
export function isSameHour(dateLeft, dateRight, options) {
const [dateLeft_, dateRight_] = normalizeDates(
options?.in,
dateLeft,
dateRight,
);
return +startOfHour(dateLeft_) === +startOfHour(dateRight_);
}
// Fallback for modularized imports:
export default isSameHour;