Cambiar formato de hora programada en pendientes a 24hs con validación de entrada
This commit is contained in:
@@ -3116,6 +3116,14 @@ function SeccionPendientes({ pacienteId, internacionId, canEdit }: { pacienteId:
|
|||||||
return;
|
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 {
|
try {
|
||||||
const payload: Partial<Pendiente> = {
|
const payload: Partial<Pendiente> = {
|
||||||
descripcion,
|
descripcion,
|
||||||
@@ -3428,11 +3436,18 @@ function SeccionPendientes({ pacienteId, internacionId, canEdit }: { pacienteId:
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Label className="text-xs font-medium">Hora Programada</Label>
|
<Label className="text-xs font-medium">Hora Programada (24hs)</Label>
|
||||||
<Input
|
<Input
|
||||||
type="time"
|
type="text"
|
||||||
|
placeholder="HH:MM (ej. 14:30)"
|
||||||
value={horaProgramada}
|
value={horaProgramada}
|
||||||
onChange={e => 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"
|
className="mt-1 h-9 text-xs"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user