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() }; }