From 747af325d9049d27d708d99c07d5c2d048f69679 Mon Sep 17 00:00:00 2001 From: Gillala Dhruthiya Date: Fri, 18 Sep 2026 20:42:57 +0530 Subject: [PATCH] fix(web): correct memory title date (#31643) --- web/src/lib/utils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/src/lib/utils.ts b/web/src/lib/utils.ts index 89c312196..5302e68f9 100644 --- a/web/src/lib/utils.ts +++ b/web/src/lib/utils.ts @@ -389,12 +389,12 @@ export const handlePromiseError = (promise: Promise): 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');