Files
klz-cables.com/.pnpm-store/v10/files/e7/868ddb2388152952afc75acec37a0168d2a529a3a37822456604f681138b144390a7ae294c014f30f8e2cf027421a0646f79517b40b8f61911bfab5b38d4bc
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.2 KiB
Plaintext

import { normalizeDates } from "./_lib/normalizeDates.js";
import { startOfQuarter } from "./startOfQuarter.js";
/**
* The {@link isSameQuarter} function options.
*/
/**
* @name isSameQuarter
* @category Quarter Helpers
* @summary Are the given dates in the same quarter (and year)?
*
* @description
* Are the given dates in the same quarter (and year)?
*
* @param laterDate - The first date to check
* @param earlierDate - The second date to check
* @param options - An object with options
*
* @returns The dates are in the same quarter (and year)
*
* @example
* // Are 1 January 2014 and 8 March 2014 in the same quarter?
* const result = isSameQuarter(new Date(2014, 0, 1), new Date(2014, 2, 8))
* //=> true
*
* @example
* // Are 1 January 2014 and 1 January 2015 in the same quarter?
* const result = isSameQuarter(new Date(2014, 0, 1), new Date(2015, 0, 1))
* //=> false
*/
export function isSameQuarter(laterDate, earlierDate, options) {
const [dateLeft_, dateRight_] = normalizeDates(
options?.in,
laterDate,
earlierDate,
);
return +startOfQuarter(dateLeft_) === +startOfQuarter(dateRight_);
}
// Fallback for modularized imports:
export default isSameQuarter;