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

54 lines
1.2 KiB
Plaintext

import { Parser } from "../Parser.mjs";
import { dayPeriodEnumToHours } from "../utils.mjs";
export class AMPMParser extends Parser {
priority = 80;
parse(dateString, token, match) {
switch (token) {
case "a":
case "aa":
case "aaa":
return (
match.dayPeriod(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.dayPeriod(dateString, {
width: "narrow",
context: "formatting",
})
);
case "aaaaa":
return match.dayPeriod(dateString, {
width: "narrow",
context: "formatting",
});
case "aaaa":
default:
return (
match.dayPeriod(dateString, {
width: "wide",
context: "formatting",
}) ||
match.dayPeriod(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.dayPeriod(dateString, {
width: "narrow",
context: "formatting",
})
);
}
}
set(date, _flags, value) {
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
return date;
}
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
}