Rocky_Mountain_Vending/.pnpm-store/v10/files/8d/32e6b892bfee54536bc14e8b67d447eaadaa0a0920c866124a300b7eff28784e42bf6a012e01cbb1c10f73e1c093974ddedf68322f8497e6c6b6fa703ea64b
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

63 lines
1.2 KiB
Text

import { numericPatterns } from "../constants.js";
import { Parser } from "../Parser.js";
import {
isLeapYearIndex,
parseNDigits,
parseNumericPattern,
} from "../utils.js";
import { setMonth as coreSetMonth } from "../../../_core/setMonth.js";
import { getFullYear as coreGetFullYear } from "../../../_core/getFullYear.js";
export class DayOfYearParser extends Parser {
priority = 90;
subpriority = 1;
parse(dateString, token, match) {
switch (token) {
case "D":
case "DD":
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
case "Do":
return match.ordinalNumber(dateString, { unit: "date" });
default:
return parseNDigits(token.length, dateString);
}
}
validate(date, value) {
const year = coreGetFullYear(date);
const isLeapYear = isLeapYearIndex(year);
if (isLeapYear) {
return value >= 1 && value <= 366;
} else {
return value >= 1 && value <= 365;
}
}
set(date, _flags, value) {
coreSetMonth(date, 0, value);
date.setHours(0, 0, 0, 0);
return date;
}
incompatibleTokens = [
"Y",
"R",
"q",
"Q",
"M",
"L",
"w",
"I",
"d",
"E",
"i",
"e",
"c",
"t",
"T",
];
}