Files
klz-cables.com/.pnpm-store/v10/files/bc/0ac34c694581b767916372b867ad49175b41e837475bef14cc82afe311a45f111a06764f04e4f0ce56bc78ac4ab290662e732eb5acca4e65630c97223b64df
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

86 lines
1.9 KiB
Plaintext

"use strict";
exports.StandAloneQuarterParser = void 0;
var _Parser = require("../Parser.cjs");
var _utils = require("../utils.cjs");
class StandAloneQuarterParser extends _Parser.Parser {
priority = 120;
parse(dateString, token, match) {
switch (token) {
// 1, 2, 3, 4
case "q":
case "qq": // 01, 02, 03, 04
return (0, _utils.parseNDigits)(token.length, dateString);
// 1st, 2nd, 3rd, 4th
case "qo":
return match.ordinalNumber(dateString, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "qqq":
return (
match.quarter(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.quarter(dateString, {
width: "narrow",
context: "standalone",
})
);
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "qqqqq":
return match.quarter(dateString, {
width: "narrow",
context: "standalone",
});
// 1st quarter, 2nd quarter, ...
case "qqqq":
default:
return (
match.quarter(dateString, {
width: "wide",
context: "standalone",
}) ||
match.quarter(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.quarter(dateString, {
width: "narrow",
context: "standalone",
})
);
}
}
validate(_date, value) {
return value >= 1 && value <= 4;
}
set(date, _flags, value) {
date.setMonth((value - 1) * 3, 1);
date.setHours(0, 0, 0, 0);
return date;
}
incompatibleTokens = [
"Y",
"R",
"Q",
"M",
"L",
"w",
"I",
"d",
"D",
"i",
"e",
"c",
"t",
"T",
];
}
exports.StandAloneQuarterParser = StandAloneQuarterParser;