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,7 +1,15 @@
"use strict";
exports.eachWeekendOfInterval = eachWeekendOfInterval;
var _index = require("./eachDayOfInterval.js");
var _index2 = require("./isWeekend.js");
import { normalizeInterval } from "./_lib/normalizeInterval.js";
import { constructFrom } from "./constructFrom.js";
import { eachDayOfInterval } from "./eachDayOfInterval.js";
import { isWeekend } from "./isWeekend.js";
/**
* The {@link eachWeekendOfInterval} function options.
*/
/**
* The {@link eachWeekendOfInterval} function result type.
*/
/**
* @name eachWeekendOfInterval
@@ -11,9 +19,11 @@ var _index2 = require("./isWeekend.js");
* @description
* Get all the Saturdays and Sundays in the given date interval.
*
* @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).
* @typeParam IntervalType - Interval type.
* @typeParam Options - Options type.
*
* @param interval - The given interval
* @param options - An object with options
*
* @returns An array containing all the Saturdays and Sundays
*
@@ -30,13 +40,17 @@ var _index2 = require("./isWeekend.js");
* // Sun Sep 30 2018 00:00:00
* // ]
*/
function eachWeekendOfInterval(interval) {
const dateInterval = (0, _index.eachDayOfInterval)(interval);
export function eachWeekendOfInterval(interval, options) {
const { start, end } = normalizeInterval(options?.in, interval);
const dateInterval = eachDayOfInterval({ start, end }, options);
const weekends = [];
let index = 0;
while (index < dateInterval.length) {
const date = dateInterval[index++];
if ((0, _index2.isWeekend)(date)) weekends.push(date);
if (isWeekend(date)) weekends.push(constructFrom(start, date));
}
return weekends;
}
// Fallback for modularized imports:
export default eachWeekendOfInterval;