Rocky_Mountain_Vending/.pnpm-store/v10/files/a3/70b5d3415d2df8d2beadd5ae9b89f1fd7650c61489fd413921ba5ae6a19f7bbb9ec419f561c26392dea37981c5ef3a4b8b25cd48f43691de3ece87580b4e12
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

87 lines
2 KiB
Text

import { numericPatterns } from "../constants.js";
import { Parser } from "../Parser.js";
import { mapValue, parseNDigits, parseNumericPattern } from "../utils.js";
import { setMonth as coreSetMonth } from "../../../_core/setMonth.js";
export class StandAloneMonthParser extends Parser {
priority = 110;
parse(dateString, token, match) {
const valueCallback = (value) => value - 1;
switch (token) {
// 1, 2, ..., 12
case "L":
return mapValue(
parseNumericPattern(numericPatterns.month, dateString),
valueCallback,
);
// 01, 02, ..., 12
case "LL":
return mapValue(parseNDigits(2, dateString), valueCallback);
// 1st, 2nd, ..., 12th
case "Lo":
return mapValue(
match.ordinalNumber(dateString, {
unit: "month",
}),
valueCallback,
);
// Jan, Feb, ..., Dec
case "LLL":
return (
match.month(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.month(dateString, { width: "narrow", context: "standalone" })
);
// J, F, ..., D
case "LLLLL":
return match.month(dateString, {
width: "narrow",
context: "standalone",
});
// January, February, ..., December
case "LLLL":
default:
return (
match.month(dateString, { width: "wide", context: "standalone" }) ||
match.month(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.month(dateString, { width: "narrow", context: "standalone" })
);
}
}
validate(_date, value) {
return value >= 0 && value <= 11;
}
set(date, _flags, value) {
coreSetMonth(date, value, 1);
date.setHours(0, 0, 0, 0);
return date;
}
incompatibleTokens = [
"Y",
"R",
"q",
"Q",
"M",
"w",
"I",
"D",
"i",
"e",
"c",
"t",
"T",
];
}