diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2025-11-18 00:27:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-18 00:27:51 +0100 |
| commit | 133db456a4bd069daecb60b3ec6fa147868493a3 (patch) | |
| tree | 23c3ec3aea66a0012c00b2456490ebc0eedd77fb /src/frontend/app/components/SchedulesTable.tsx | |
| parent | 276e73412abef28c222c52a84334d49f5e414f3c (diff) | |
Handle GTFS times exceeding 24 hours for night services (#98)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com>
Co-authored-by: Ariel Costas Guerrero <ariel@costas.dev>
Diffstat (limited to 'src/frontend/app/components/SchedulesTable.tsx')
| -rw-r--r-- | src/frontend/app/components/SchedulesTable.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/frontend/app/components/SchedulesTable.tsx b/src/frontend/app/components/SchedulesTable.tsx index 60e7ab0..5df01e5 100644 --- a/src/frontend/app/components/SchedulesTable.tsx +++ b/src/frontend/app/components/SchedulesTable.tsx @@ -95,6 +95,13 @@ const timeToMinutes = (time: string): number => { return hours * 60 + minutes; }; +// Utility function to format GTFS time for display (handle hours >= 24) +const formatTimeForDisplay = (time: string): string => { + const [hours, minutes] = time.split(":").map(Number); + const normalizedHours = hours % 24; + return `${normalizedHours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`; +}; + // Utility function to find nearby entries const findNearbyEntries = ( entries: ScheduledTable[], @@ -178,7 +185,7 @@ export const SchedulesTable: React.FC<TimetableTableProps> = ({ <div className="time-info"> <span className="departure-time"> - {entry.calling_time.slice(0, 5)} + {formatTimeForDisplay(entry.calling_time)} </span> </div> </div> |
