From 51a8515b40f12a764f8b86bc033597fb5d8b816b Mon Sep 17 00:00:00 2001 From: icamarillo Date: Mon, 16 Feb 2026 08:24:14 -0700 Subject: [PATCH] =?UTF-8?q?Fix:=20Corregir=20formato=20de=20fechas=20en=20?= =?UTF-8?q?auditor=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enviar datetime ISO completo en lugar de solo fecha (YYYY-MM-DD) - Backend requiere formato datetime ISO 8601 - Agregar hora 00:00:00 para fecha inicio y 23:59:59 para fecha fin - Manejar correctamente fechas custom vacĂ­as - Soluciona error 422 (Unprocessable Entity) --- .../src/routes/audit/+page.svelte | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend-internal/src/routes/audit/+page.svelte b/frontend-internal/src/routes/audit/+page.svelte index 567b806..6760c52 100644 --- a/frontend-internal/src/routes/audit/+page.svelte +++ b/frontend-internal/src/routes/audit/+page.svelte @@ -52,6 +52,8 @@ switch (periodFilter) { case 'today': from = new Date(today); + to = new Date(); + to.setHours(23, 59, 59, 999); break; case 'yesterday': from = new Date(today); @@ -62,23 +64,35 @@ case 'last7days': from = new Date(today); from.setDate(from.getDate() - 7); + to = new Date(); + to.setHours(23, 59, 59, 999); break; case 'last30days': from = new Date(today); from.setDate(from.getDate() - 30); + to = new Date(); + to.setHours(23, 59, 59, 999); break; case 'custom': + // Para fechas custom, parsear las fechas string y agregar hora + if (!customDateFrom || !customDateTo) { + return { from: '', to: '' }; + } + const fromDate = new Date(customDateFrom); + fromDate.setHours(0, 0, 0, 0); + const toDate = new Date(customDateTo); + toDate.setHours(23, 59, 59, 999); return { - from: customDateFrom, - to: customDateTo + from: fromDate.toISOString(), + to: toDate.toISOString() }; default: from = new Date(today); } return { - from: from.toISOString().split('T')[0], - to: to.toISOString().split('T')[0] + from: from.toISOString(), + to: to.toISOString() }; }