Files
klz-cables.com/.pnpm-store/v10/files/c3/06b85917c4d04e07f79fd420af85906ada70ea8b4dde5be938404ea2b88cc837558764c7449247e9fff9644d37f76286f3025f9a70392689cea7da3162c1a7
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 AMPMMidnightParser extends Parser {
priority = 80;
parse(dateString, token, match) {
switch (token) {
case "b":
case "bb":
case "bbb":
return (
match.dayPeriod(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.dayPeriod(dateString, {
width: "narrow",
context: "formatting",
})
);
case "bbbbb":
return match.dayPeriod(dateString, {
width: "narrow",
context: "formatting",
});
case "bbbb":
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 = ["a", "B", "H", "k", "t", "T"];
}