From c2d693fc9afa6ac712011f472b99b01582d95f66 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Fri, 3 Apr 2026 08:21:29 +0100 Subject: [PATCH] Fix off-by-one date display for UTC-negative timezone users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit beginningOfDay() used local timezone methods (getFullYear, getMonth, getDate) to snap timestamps to midnight. Since the server sends UTC timestamps, this caused day boundary calculations to be off by one for users in UTC-negative timezones — cards created after UTC midnight but before local midnight showed as "yesterday" instead of "today". Switch to UTC methods (getUTCFullYear, getUTCMonth, getUTCDate) so day boundaries are calculated consistently with the server's UTC timestamps. Affects DaysAgoFormatter, DaysAgoOrWeekdayFormatter, TimeOrDateFormatter, InDaysFormatter, and bubble controller stalled/entropy calculations. --- app/javascript/helpers/date_helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/helpers/date_helpers.js b/app/javascript/helpers/date_helpers.js index b8d9855f4..1fc21b995 100644 --- a/app/javascript/helpers/date_helpers.js +++ b/app/javascript/helpers/date_helpers.js @@ -7,7 +7,7 @@ export function signedDifferenceInDays(fromDate, toDate) { } export function beginningOfDay(date) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate()) + return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())) } export function secondsToDate(seconds) {