From fcfa536b9d36be2ceb3114461bff53d9869cfac6 Mon Sep 17 00:00:00 2001 From: Santiago Lavaise Date: Mon, 13 Apr 2026 12:04:57 -0300 Subject: [PATCH] Add: Formato DD-MM-YYYY para fechas de ingreso --- src/lib/utils.ts | 10 ++++++++++ src/sections/Dashboard.tsx | 3 ++- src/sections/HistoriaClinica.tsx | 3 ++- src/sections/Internaciones.tsx | 3 ++- src/sections/MapaCamas.tsx | 3 ++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index bd0c391..0b799de 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -4,3 +4,13 @@ import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } + +export function formatDateDDMMYYYY(dateString: string): string { + if (!dateString) return ''; + const date = new Date(dateString); + if (isNaN(date.getTime())) return dateString; + const day = String(date.getDate()).padStart(2, '0'); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const year = date.getFullYear(); + return `${day}-${month}-${year}`; +} diff --git a/src/sections/Dashboard.tsx b/src/sections/Dashboard.tsx index ab35f25..670a714 100644 --- a/src/sections/Dashboard.tsx +++ b/src/sections/Dashboard.tsx @@ -13,6 +13,7 @@ import { import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; +import { formatDateDDMMYYYY } from '@/lib/utils'; import type { Vista, Internacion, Paciente, Cultivo } from '@/types'; interface DashboardProps { @@ -209,7 +210,7 @@ export function Dashboard({ {paciente ? `${paciente.apellido}, ${paciente.nombre}` : 'Paciente no encontrado'}

- Ingreso: {internacion.fechaIngreso} + Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}

diff --git a/src/sections/HistoriaClinica.tsx b/src/sections/HistoriaClinica.tsx index ef0ef7d..5a41816 100644 --- a/src/sections/HistoriaClinica.tsx +++ b/src/sections/HistoriaClinica.tsx @@ -33,6 +33,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; import type { Laboratorio, AcidoBase, Cultivo, Paciente, ResultadoLaboratorio, Internacion, Evolucion, Cama } from '@/types'; +import { formatDateDDMMYYYY } from '@/lib/utils'; interface HistoriaClinicaProps { internacion: Internacion; @@ -271,7 +272,7 @@ export function HistoriaClinica({

Fecha de Ingreso

-

{internacion.fechaIngreso}

+

{formatDateDDMMYYYY(internacion.fechaIngreso)}

Diagnóstico de Ingreso

diff --git a/src/sections/Internaciones.tsx b/src/sections/Internaciones.tsx index 43c3626..8e9ab1c 100644 --- a/src/sections/Internaciones.tsx +++ b/src/sections/Internaciones.tsx @@ -8,6 +8,7 @@ import { Label } from '@/components/ui/label'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import type { Internacion, Paciente, Cama, Area, Evolucion, Laboratorio, Cultivo } from '@/types'; +import { formatDateDDMMYYYY } from '@/lib/utils'; interface InternacionesProps { internaciones: Internacion[]; @@ -333,7 +334,7 @@ export function Internaciones({
- Ingreso: {internacion.fechaIngreso} + Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}
diff --git a/src/sections/MapaCamas.tsx b/src/sections/MapaCamas.tsx index 775e634..8082dce 100644 --- a/src/sections/MapaCamas.tsx +++ b/src/sections/MapaCamas.tsx @@ -3,6 +3,7 @@ import { Bed, CheckCircle2, Clock, Wrench, User, Plus, Trash, Edit2, Save, X } f import { Card, CardContent } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; +import { formatDateDDMMYYYY } from '@/lib/utils'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Label } from '@/components/ui/label'; @@ -331,7 +332,7 @@ export function MapaCamas({

Paciente:

{paciente.apellido}, {paciente.nombre}

DNI: {paciente.dni}

-

Ingreso: {internacion.fechaIngreso}

+

Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}

Diagnóstico: {internacion.diagnosticoIngreso}

Médico: {internacion.medicoIngresante}