Add: Formato DD-MM-YYYY para fechas de ingreso

This commit is contained in:
Santiago Lavaise
2026-04-13 12:04:57 -03:00
parent 8966c2f9b1
commit fcfa536b9d
5 changed files with 18 additions and 4 deletions
+10
View File
@@ -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}`;
}
+2 -1
View File
@@ -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'}
</p>
<p className="text-sm text-gray-500">
Ingreso: {internacion.fechaIngreso}
Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}
</p>
</div>
<Badge variant="outline" className="bg-purple-50 text-purple-700">
+2 -1
View File
@@ -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({
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm w-full">
<div>
<p className="text-gray-500">Fecha de Ingreso</p>
<p className="font-medium">{internacion.fechaIngreso}</p>
<p className="font-medium">{formatDateDDMMYYYY(internacion.fechaIngreso)}</p>
</div>
<div>
<p className="text-gray-500">Diagnóstico de Ingreso</p>
+2 -1
View File
@@ -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({
</div>
<div className="flex items-center gap-2 text-gray-600">
<Calendar className="h-4 w-4" />
<span>Ingreso: {internacion.fechaIngreso}</span>
<span>Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}</span>
</div>
<div className="flex items-center gap-2 text-gray-600">
<Stethoscope className="h-4 w-4" />
+2 -1
View File
@@ -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({
<p className="font-medium">Paciente:</p>
<p className="text-lg">{paciente.apellido}, {paciente.nombre}</p>
<p className="text-sm text-gray-500">DNI: {paciente.dni}</p>
<p className="text-sm text-gray-500">Ingreso: {internacion.fechaIngreso}</p>
<p className="text-sm text-gray-500">Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}</p>
<p className="text-sm text-gray-500">Diagnóstico: {internacion.diagnosticoIngreso}</p>
<p className="text-sm text-gray-500">Médico: {internacion.medicoIngresante}</p>
</div>