From 12cf9ea4144ae9ac65c2ad860e45d48395eb9cdb Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sun, 3 Mar 2024 10:16:02 +0200 Subject: [PATCH] Fix Today/Yesterday wrong with negative timezones Applied offset to "now" when comparing with offset timestamps. Affects issues: - Possibly fixed #3420 --- Plan/react/dashboard/src/components/text/FormattedDate.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plan/react/dashboard/src/components/text/FormattedDate.jsx b/Plan/react/dashboard/src/components/text/FormattedDate.jsx index ae09a078b..8c7d5b540 100644 --- a/Plan/react/dashboard/src/components/text/FormattedDate.jsx +++ b/Plan/react/dashboard/src/components/text/FormattedDate.jsx @@ -28,11 +28,11 @@ export function formatDate(date, offset, pattern, recentDays, recentDaysPattern, let format = pattern; if (recentDays) { - if (timestamp > now - fromStartOfToday) { + if (timestamp > now - offset - fromStartOfToday) { format = format.replace(recentDaysPattern, t('plugin.generic.today')); - } else if (timestamp > now - dayMs - fromStartOfToday) { + } else if (timestamp > now - offset - dayMs - fromStartOfToday) { format = format.replace(recentDaysPattern, t('plugin.generic.yesterday')); - } else if (timestamp > now - dayMs * 5) { + } else if (timestamp > now - offset - dayMs * 5) { format = format.replace(recentDaysPattern, "EEEE"); } }