fix(historial): default hoy en vez de 7 días para evitar timeout inicial

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-29 20:30:37 -05:00
co-authored by Claude Sonnet 4.6
parent e3216faaa5
commit 00f6e7f759
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -22,11 +22,10 @@ $pdo = db();
// ── Parámetros ──────────────────────────────────────────────── // ── Parámetros ────────────────────────────────────────────────
$hoy = date('Y-m-d'); $hoy = date('Y-m-d');
$hace7 = date('Y-m-d', strtotime('-6 days'));
$fechaDesde = trim($_GET['fecha_desde'] ?? ''); $fechaDesde = trim($_GET['fecha_desde'] ?? '');
$fechaHasta = trim($_GET['fecha_hasta'] ?? ''); $fechaHasta = trim($_GET['fecha_hasta'] ?? '');
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $fechaDesde)) $fechaDesde = $hace7; if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $fechaDesde)) $fechaDesde = $hoy;
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $fechaHasta)) $fechaHasta = $hoy; if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $fechaHasta)) $fechaHasta = $hoy;
if ($fechaDesde > $fechaHasta) $fechaDesde = $fechaHasta; if ($fechaDesde > $fechaHasta) $fechaDesde = $fechaHasta;
+2 -2
View File
@@ -262,8 +262,8 @@ function hace(n){ return new Date(Date.now()-n*86400000).toISOString().slice(0,1
// ── Inicialización ──────────────────────────────────────────── // ── Inicialización ────────────────────────────────────────────
document.addEventListener('DOMContentLoaded', async () => { document.addEventListener('DOMContentLoaded', async () => {
// Fecha por defecto: últimos 7 días // Fecha por defecto: hoy
document.getElementById('fDesde').value = hace(6); document.getElementById('fDesde').value = hoy();
document.getElementById('fHasta').value = hoy(); document.getElementById('fHasta').value = hoy();
document.getElementById('fHasta').max = hoy(); document.getElementById('fHasta').max = hoy();