From 00f6e7f759caba5aea7c2fb378443ab3fe05cb14 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 29 Jul 2026 20:30:37 -0500 Subject: [PATCH] =?UTF-8?q?fix(historial):=20default=20hoy=20en=20vez=20de?= =?UTF-8?q?=207=20d=C3=ADas=20para=20evitar=20timeout=20inicial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/api/get_historial.php | 5 ++--- modules/turnero/views/historial.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/turnero/api/get_historial.php b/modules/turnero/api/get_historial.php index 8d0da90..39773a3 100644 --- a/modules/turnero/api/get_historial.php +++ b/modules/turnero/api/get_historial.php @@ -21,12 +21,11 @@ requireMethod('GET'); $pdo = db(); // ── Parámetros ──────────────────────────────────────────────── -$hoy = date('Y-m-d'); -$hace7 = date('Y-m-d', strtotime('-6 days')); +$hoy = date('Y-m-d'); $fechaDesde = trim($_GET['fecha_desde'] ?? ''); $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 ($fechaDesde > $fechaHasta) $fechaDesde = $fechaHasta; diff --git a/modules/turnero/views/historial.php b/modules/turnero/views/historial.php index d54c45b..0e0e654 100644 --- a/modules/turnero/views/historial.php +++ b/modules/turnero/views/historial.php @@ -262,8 +262,8 @@ function hace(n){ return new Date(Date.now()-n*86400000).toISOString().slice(0,1 // ── Inicialización ──────────────────────────────────────────── document.addEventListener('DOMContentLoaded', async () => { - // Fecha por defecto: últimos 7 días - document.getElementById('fDesde').value = hace(6); + // Fecha por defecto: hoy + document.getElementById('fDesde').value = hoy(); document.getElementById('fHasta').value = hoy(); document.getElementById('fHasta').max = hoy();