Files
klz-cables.com/.pnpm-store/v10/files/6a/b6605d3a2c1312decbf9f1bf9c848c03807bc2a52484ca8098da533401b1e5ace4e4af43271b34c4b20a910759499df0cb8186c6bdf0a9250aabd7a52d5521
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

41 lines
1.4 KiB
Plaintext

"use strict";
exports.setISODay = setISODay;
var _index = require("./addDays.cjs");
var _index2 = require("./getISODay.cjs");
var _index3 = require("./toDate.cjs");
/**
* The {@link setISODay} function options.
*/
/**
* @name setISODay
* @category Weekday Helpers
* @summary Set the day of the ISO week to the given date.
*
* @description
* Set the day of the ISO week to the given date.
* ISO week starts with Monday.
* 7 is the index of Sunday, 1 is the index of Monday, etc.
*
* @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 ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
*
* @param date - The date to be changed
* @param day - The day of the ISO week of the new date
* @param options - An object with options
*
* @returns The new date with the day of the ISO week set
*
* @example
* // Set Sunday to 1 September 2014:
* const result = setISODay(new Date(2014, 8, 1), 7)
* //=> Sun Sep 07 2014 00:00:00
*/
function setISODay(date, day, options) {
const date_ = (0, _index3.toDate)(date, options?.in);
const currentDay = (0, _index2.getISODay)(date_, options);
const diff = day - currentDay;
return (0, _index.addDays)(date_, diff, options);
}