diff --git a/src/pages/TicketPage.jsx b/src/pages/TicketPage.jsx index 6e410f0..1416cd4 100644 --- a/src/pages/TicketPage.jsx +++ b/src/pages/TicketPage.jsx @@ -63,14 +63,16 @@ export default function TicketPage() { return } -// Datum und Uhrzeitspanne bleiben je in einer Zeile: umbrechen darf nur das Komma dazwischen. -// Rohtext ohne ", " (unlesbare Altwerte) bricht weiter frei um. +// Eine gelesene Uhrzeit oder Spanne ("09:30" bzw. "09:30–10:30") bricht nicht in sich um, nur davor am Komma. +// Unlesbare Altwerte (Rohtext) brechen weiter frei um. +const TIME_RANGE = /^\d{2}:\d{2}(–\d{2}:\d{2})?$/ + function AppointmentText({ text }) { - const at = text.indexOf(', ') - if (at === -1) return text + const at = text.lastIndexOf(', ') + if (at === -1 || !TIME_RANGE.test(text.slice(at + 2))) return text return ( <> - {text.slice(0, at)}, {text.slice(at + 2)} + {text.slice(0, at)}, {text.slice(at + 2)} ) }