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:
co-authored by
Claude Sonnet 4.6
parent
e3216faaa5
commit
00f6e7f759
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user