Files
klz-cables.com/.pnpm-store/v10/files/89/f79de0919c251e32a28b0fb87155ce63096e72de7aa9e07d2973574c027eafd066200441b724c7556ef535f5ffa7c6b90662903a0ab6280ea6c75d15c8d7d8
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

29 lines
760 B
Plaintext

"use strict";
exports.getQuarter = getQuarter;
var _index = require("./toDate.js");
/**
* @name getQuarter
* @category Quarter Helpers
* @summary Get the year quarter of the given date.
*
* @description
* Get the year quarter of the given date.
*
* @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 date - The given date
*
* @returns The quarter
*
* @example
* // Which quarter is 2 July 2014?
* const result = getQuarter(new Date(2014, 6, 2))
* //=> 3
*/
function getQuarter(date) {
const _date = (0, _index.toDate)(date);
const quarter = Math.trunc(_date.getMonth() / 3) + 1;
return quarter;
}