main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

62
node_modules/date-fns/parse/_lib/parsers/DayParser.mjs generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import { setDay } from "../../../setDay.mjs";
import { Parser } from "../Parser.mjs";
// Day of week
export class DayParser extends Parser {
priority = 90;
parse(dateString, token, match) {
switch (token) {
// Tue
case "E":
case "EE":
case "EEE":
return (
match.day(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.day(dateString, { width: "short", context: "formatting" }) ||
match.day(dateString, { width: "narrow", context: "formatting" })
);
// T
case "EEEEE":
return match.day(dateString, {
width: "narrow",
context: "formatting",
});
// Tu
case "EEEEEE":
return (
match.day(dateString, { width: "short", context: "formatting" }) ||
match.day(dateString, { width: "narrow", context: "formatting" })
);
// Tuesday
case "EEEE":
default:
return (
match.day(dateString, { width: "wide", context: "formatting" }) ||
match.day(dateString, {
width: "abbreviated",
context: "formatting",
}) ||
match.day(dateString, { width: "short", context: "formatting" }) ||
match.day(dateString, { width: "narrow", context: "formatting" })
);
}
}
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 = ["D", "i", "e", "c", "t", "T"];
}