From 8497ecbb4f870556e1b3159e0edd661d73f28ee5 Mon Sep 17 00:00:00 2001 From: snlavaise Date: Wed, 12 Aug 2026 01:07:15 +0000 Subject: [PATCH] =?UTF-8?q?Cambiar=20formato=20de=20hora=20programada=20en?= =?UTF-8?q?=20pendientes=20a=2024hs=20con=20validaci=C3=B3n=20de=20entrada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sections/HistoriaClinica.tsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/sections/HistoriaClinica.tsx b/src/sections/HistoriaClinica.tsx index 3ba06d0..b2794dc 100644 --- a/src/sections/HistoriaClinica.tsx +++ b/src/sections/HistoriaClinica.tsx @@ -3116,6 +3116,14 @@ function SeccionPendientes({ pacienteId, internacionId, canEdit }: { pacienteId: return; } + if (horaProgramada.trim()) { + const timeRegex = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/; + if (!timeRegex.test(horaProgramada.trim())) { + toast.error('La hora programada debe estar en formato de 24hs (ej: 14:30)'); + return; + } + } + try { const payload: Partial = { descripcion, @@ -3428,11 +3436,18 @@ function SeccionPendientes({ pacienteId, internacionId, canEdit }: { pacienteId: />
- + setHoraProgramada(e.target.value)} + onChange={e => { + let val = e.target.value; + val = val.replace(/[^0-9:]/g, ''); + if (val.length <= 5) { + setHoraProgramada(val); + } + }} className="mt-1 h-9 text-xs" />