Rocky_Mountain_Vending/.pnpm-store/v10/files/6f/7f4b98b9d5e0db1d497a3537e65c93b39bdbdc3652224d8f94cad5cb2041d35b31087c9e4d8e992009e364f95d56c12c6d54cb320523ead533907aa7ecda07
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

99 lines
2.4 KiB
Text

import { setDay } from "../../../setDay.js";
import { Parser } from "../Parser.js";
import { mapValue, parseNDigits } from "../utils.js";
// Stand-alone local day of week
export class StandAloneLocalDayParser extends Parser {
priority = 90;
parse(dateString, token, match, options) {
const valueCallback = (value) => {
// We want here floor instead of trunc, so we get -7 for value 0 instead of 0
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
return (
((value + options.weekStartsOn + 6 /* move sun -> sat */ + 1) % 7) +
wholeWeekDays
);
};
switch (token) {
// 3
case "c":
case "cc": // 03
return mapValue(parseNDigits(token.length, dateString), valueCallback);
// 3rd
case "co":
return mapValue(
match.ordinalNumber(dateString, {
unit: "day",
}),
valueCallback,
);
// Tue
case "ccc":
return (
match.day(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.day(dateString, { width: "short", context: "standalone" }) ||
match.day(dateString, { width: "narrow", context: "standalone" })
);
// T
case "ccccc":
return match.day(dateString, {
width: "narrow",
context: "standalone",
});
// Tu
case "cccccc":
return (
match.day(dateString, { width: "short", context: "standalone" }) ||
match.day(dateString, { width: "narrow", context: "standalone" })
);
// Tuesday
case "cccc":
default:
return (
match.day(dateString, { width: "wide", context: "standalone" }) ||
match.day(dateString, {
width: "abbreviated",
context: "standalone",
}) ||
match.day(dateString, { width: "short", context: "standalone" }) ||
match.day(dateString, { width: "narrow", context: "standalone" })
);
}
}
validate(_date, value) {
return value >= 0 && value <= 6;
}
set(date, _flags, value, options) {
date = setDay(date, value, options);
date.setHours(0, 0, 0, 0);
return date;
}
incompatibleTokens = [
"y",
"R",
"u",
"q",
"Q",
"M",
"L",
"I",
"d",
"D",
"E",
"i",
"e",
"t",
"T",
];
}