Rocky_Mountain_Vending/.pnpm-store/v10/files/96/5f06463bcc71b101861633d35fd180efc4d68434e9a253bed4922cfd661469c7a97d01a8f3860aa88e3147c3c277a782b7c2223529b0443c5667ee9bfd7985
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

55 lines
1.3 KiB
Text

import { Parser } from "../Parser.js";
import { dayPeriodEnumToHours } from "../utils.js";
// in the morning, in the afternoon, in the evening, at night
export class DayPeriodParser 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", "t", "T"];
}