Skip to content

High performance self-hosted photo and video management solution.

fix(web): correct memory title date (#31643)

Gillala Dhruthiya747af325d904
diff --git a/web/src/lib/utils.ts b/web/src/lib/utils.ts
index 89c312196d..5302e68f9e 100644
--- a/web/src/lib/utils.ts
+++ b/web/src/lib/utils.ts
@@ -389,12 +389,12 @@ export const handlePromiseError = <T>(promise: Promise<T>): void => {
export const memoryLaneTitle = derived(t, ($t) => {
return (memory: MemoryResponseDto) => {
if (memory.type === MemoryType.OnThisDay) {
- const now = new Date();
- const memoryDate = new Date(memory.memoryAt);
+ const now = DateTime.now();
+ const memoryDate = DateTime.fromISO(memory.memoryAt, { zone: 'utc' });
- return memoryDate.getUTCDate() === now.getDate() && memoryDate.getUTCMonth() === now.getMonth()
- ? $t('years_ago', { values: { years: now.getFullYear() - memory.data.year } })
- : DateTime.fromJSDate(memoryDate).toLocaleString(DateTime.DATE_MED, { locale: get(locale) });
+ return memoryDate.day === now.day && memoryDate.month === now.month
+ ? $t('years_ago', { values: { years: now.year - memory.data.year } })
+ : memoryDate.toLocaleString(DateTime.DATE_MED, { locale: get(locale) });
}
return $t('unknown');