- ✅ 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
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
"use strict";
|
|
exports.setISODay = setISODay;
|
|
var _index = require("./addDays.js");
|
|
var _index2 = require("./getISODay.js");
|
|
var _index3 = require("./toDate.js");
|
|
|
|
/**
|
|
* @name setISODay
|
|
* @category Weekday Helpers
|
|
* @summary Set the day of the ISO week to the given date.
|
|
*
|
|
* @description
|
|
* Set the day of the ISO week to the given date.
|
|
* ISO week starts with Monday.
|
|
* 7 is the index of Sunday, 1 is the index of Monday etc.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The date to be changed
|
|
* @param day - The day of the ISO week of the new date
|
|
*
|
|
* @returns The new date with the day of the ISO week set
|
|
*
|
|
* @example
|
|
* // Set Sunday to 1 September 2014:
|
|
* const result = setISODay(new Date(2014, 8, 1), 7)
|
|
* //=> Sun Sep 07 2014 00:00:00
|
|
*/
|
|
function setISODay(date, day) {
|
|
const _date = (0, _index3.toDate)(date);
|
|
const currentDay = (0, _index2.getISODay)(_date);
|
|
const diff = day - currentDay;
|
|
return (0, _index.addDays)(_date, diff);
|
|
}
|