- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
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"];
|
|
}
|