Fix: Zona Horaria Eliminada
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 2m29s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 2m29s
- Se elimina la zona horaria y se refactoriza el formateo de fecha.
This commit is contained in:
@@ -128,7 +128,22 @@ const GestionarPagosDistribuidorPage: React.FC = () => {
|
||||
setRowsPerPage(parseInt(event.target.value, 10)); setPage(0);
|
||||
};
|
||||
const displayData = pagos.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage);
|
||||
const formatDate = (dateString?: string | null) => dateString ? new Date(dateString + 'T00:00:00Z').toLocaleDateString('es-AR') : '-';
|
||||
const formatDate = (dateString?: string | null): string => {
|
||||
if (!dateString) return '-';
|
||||
// La fecha llega como "YYYY-MM-DD" o "YYYY-MM-DDTHH:mm:ss"
|
||||
// Tomamos solo la parte de la fecha para evitar problemas de zona horaria.
|
||||
const datePart = dateString.split('T')[0];
|
||||
const parts = datePart.split('-');
|
||||
|
||||
// Aseguramos que el formato sea el esperado antes de reordenar
|
||||
if (parts.length === 3) {
|
||||
// parts[0] = YYYY, parts[1] = MM, parts[2] = DD
|
||||
return `${parts[2]}/${parts[1]}/${parts[0]}`; // Formato DD/MM/YYYY
|
||||
}
|
||||
|
||||
// Si el formato no es el esperado, devolvemos la parte de la fecha tal como vino.
|
||||
return datePart;
|
||||
};
|
||||
|
||||
if (!loading && !puedeVer && !loadingFiltersDropdown) return <Box sx={{ p: 2 }}><Alert severity="error">{error || "Acceso denegado."}</Alert></Box>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user