diff --git a/frontend/src/tools/nachrichten.jsx b/frontend/src/tools/nachrichten.jsx index 7f76917..70b72d4 100644 --- a/frontend/src/tools/nachrichten.jsx +++ b/frontend/src/tools/nachrichten.jsx @@ -43,7 +43,7 @@ export default function Nachrichten({ toast, mobile }) { clearInterval(pollRef.current); if (!activeUser) return; loadMessages(activeUser.id); - pollRef.current = setInterval(() => loadMessages(activeUser.id), 15_000); + pollRef.current = setInterval(() => loadMessages(activeUser.id), 10_000); return () => clearInterval(pollRef.current); }, [activeUser?.id]); @@ -322,9 +322,15 @@ export default function Nachrichten({ toast, mobile }) { )}
- - {new Date(m.created_at).toLocaleTimeString('de-DE', { hour:'2-digit', minute:'2-digit' })} + + {formatMsgTime(m.created_at)} + {isMine && ( + + {m.read_by_recipient ? '✓✓' : '✓'} + + )}
); } + +function formatMsgTime(isoStr) { + const d = new Date(isoStr); + const now = new Date(); + const isToday = d.toDateString() === now.toDateString(); + const isThisYear = d.getFullYear() === now.getFullYear(); + const time = d.toLocaleTimeString('de-DE', { hour:'2-digit', minute:'2-digit' }); + if (isToday) return time; + if (isThisYear) return `${d.toLocaleDateString('de-DE', { day:'numeric', month:'short' })} ${time}`; + return `${d.toLocaleDateString('de-DE', { day:'numeric', month:'short', year:'numeric' })} ${time}`; +}