Files
klz-cables.com/.pnpm-store/v10/files/e9/dd12f3b4b3fee73ee683613730da4c04bb87313deb88291525324067214ad78a53cf13bf18f9b3b5d5d6787d569aece16cce9564f6d74aee555ba4f16d489b
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

43 lines
1.3 KiB
Plaintext

"use strict";
exports.eachWeekendOfInterval = eachWeekendOfInterval;
var _index = require("./eachDayOfInterval.js");
var _index2 = require("./isWeekend.js");
/**
* @name eachWeekendOfInterval
* @category Interval Helpers
* @summary List all the Saturdays and Sundays in the given date interval.
*
* @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).
*
* @param interval - The given interval
*
* @returns An array containing all the Saturdays and Sundays
*
* @example
* // Lists all Saturdays and Sundays in the given date interval
* const result = eachWeekendOfInterval({
* start: new Date(2018, 8, 17),
* end: new Date(2018, 8, 30)
* })
* //=> [
* // Sat Sep 22 2018 00:00:00,
* // Sun Sep 23 2018 00:00:00,
* // Sat Sep 29 2018 00:00:00,
* // Sun Sep 30 2018 00:00:00
* // ]
*/
function eachWeekendOfInterval(interval) {
const dateInterval = (0, _index.eachDayOfInterval)(interval);
const weekends = [];
let index = 0;
while (index < dateInterval.length) {
const date = dateInterval[index++];
if ((0, _index2.isWeekend)(date)) weekends.push(date);
}
return weekends;
}