refactor: fix memory leak in auth-modal, consolidate escapeHTML helper across 11 components
This commit is contained in:
@@ -175,31 +175,6 @@ class ConversationsService {
|
||||
notifySubscribers() {
|
||||
this.subscribers.forEach(cb => cb())
|
||||
}
|
||||
|
||||
formatMessageTime(timestamp, locale = 'de-DE') {
|
||||
const date = new Date(timestamp)
|
||||
const now = new Date()
|
||||
const diff = now - date
|
||||
|
||||
if (diff < 60000) {
|
||||
return 'Gerade eben'
|
||||
}
|
||||
|
||||
if (diff < 3600000) {
|
||||
const mins = Math.floor(diff / 60000)
|
||||
return `vor ${mins} Min.`
|
||||
}
|
||||
|
||||
if (diff < 86400000 && date.getDate() === now.getDate()) {
|
||||
return date.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
if (diff < 604800000) {
|
||||
return date.toLocaleDateString(locale, { weekday: 'short', hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
return date.toLocaleDateString(locale, { day: '2-digit', month: '2-digit', year: '2-digit' })
|
||||
}
|
||||
}
|
||||
|
||||
export const conversationsService = new ConversationsService()
|
||||
|
||||
Reference in New Issue
Block a user