Tickets: nur eine gelesene Uhrzeitspanne bleibt im Termin zusammen, Rohtext bricht weiter frei um
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ed8bdba015
commit
f6b329b208
1 file changed
+7
-5
@@ -63,14 +63,16 @@ export default function TicketPage() {
|
||||
return <TicketView key={ticket.$id} ticket={ticket} updateWorkorder={updateWorkorder} tab={activeTab} />
|
||||
}
|
||||
|
||||
// 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 (
|
||||
<>
|
||||
<span className="nowrap">{text.slice(0, at)}</span>, <span className="nowrap">{text.slice(at + 2)}</span>
|
||||
{text.slice(0, at)}, <span className="nowrap">{text.slice(at + 2)}</span>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user