diff --git a/src/languages/de.ts b/src/languages/de.ts index 9f9fe95..aa70974 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -276,6 +276,8 @@ const de = { 'time.ago.edited.months.1': 'Vor einem Monat bearbeitet', 'time.ago.edited.years': 'Vor time Jahren bearbeitet', 'time.ago.edited.years.1': 'Vor einem Jahr bearbeitet', + 'time.ago.absolute.created': 'Am $date um $time erstellt', + 'time.ago.absolute.edited': 'Am $date um $time bearbeitet', events: 'Kalender', 'events.create.success': 'Erfolgreich erstellt', 'events.create.time.start': 'Start', diff --git a/src/languages/en.ts b/src/languages/en.ts index 5c11bfe..f571204 100644 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -268,6 +268,8 @@ const en = { 'time.ago.edited.months.1': 'Edited a Month ago', 'time.ago.edited.years': 'Edited time Years ago', 'time.ago.edited.years.1': 'Edited a Year ago', + 'time.ago.absolute.created': 'Created on the $date at $time', + 'time.ago.absolute.edited': 'Edited on the $date at $time', events: 'Calendar', 'events.create.success': 'Successfully created new event', 'events.create.time.start': 'Start', diff --git a/src/lib/dates/TimeAgo.svelte b/src/lib/dates/TimeAgo.svelte index 0865938..212da93 100644 --- a/src/lib/dates/TimeAgo.svelte +++ b/src/lib/dates/TimeAgo.svelte @@ -10,6 +10,17 @@ export let type: 'edited' | 'created' = 'created'; let timeDifference: string = getTimeDifference(); + let absoluteString = i(`time.ago.absolute.${type}`, { + time: new Date(timestamp).toLocaleTimeString($currentLanguage), + date: new Date(timestamp).toLocaleDateString($currentLanguage) + }); + + currentLanguage.subscribe(() => { + absoluteString = i(`time.ago.absolute.${type}`, { + time: new Date(timestamp).toLocaleTimeString($currentLanguage), + date: new Date(timestamp).toLocaleDateString($currentLanguage) + }); + }); function getTimeDifference() { const currentTime = Date.now(); @@ -60,7 +71,7 @@