From 6d71385846ab7f76fc99eceb2bf678eb1eb4cf27 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Mon, 6 Apr 2026 09:21:03 +0100 Subject: [PATCH] Fix timezone handling for day timeline and card dates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert beginningOfDay() to use local timezone methods — the UTC change from #2790 caused cards created earlier the same day to show "yesterday" for users in UTC-negative timezones after their local 7 PM. Add Time.zone.name to day timeline fragment cache keys so timezone-different renders don't collide. --- app/javascript/helpers/date_helpers.js | 2 +- app/models/user/day_timeline.rb | 2 +- app/views/events/day_timeline/_columns.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/helpers/date_helpers.js b/app/javascript/helpers/date_helpers.js index 1fc21b995..b8d9855f4 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.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())) + return new Date(date.getFullYear(), date.getMonth(), date.getDate()) } export function secondsToDate(seconds) { diff --git a/app/models/user/day_timeline.rb b/app/models/user/day_timeline.rb index 4b30d24ca..137122f5a 100644 --- a/app/models/user/day_timeline.rb +++ b/app/models/user/day_timeline.rb @@ -42,7 +42,7 @@ class User::DayTimeline end def cache_key - ActiveSupport::Cache.expand_cache_key [ user, filter, day.to_date, events ], "day-timeline" + ActiveSupport::Cache.expand_cache_key [ user, filter, day.to_date, Time.zone.name, events ], "day-timeline" end private diff --git a/app/views/events/day_timeline/_columns.html.erb b/app/views/events/day_timeline/_columns.html.erb index 80752d9ad..16d09ed07 100644 --- a/app/views/events/day_timeline/_columns.html.erb +++ b/app/views/events/day_timeline/_columns.html.erb @@ -1,4 +1,4 @@ -<% cache [ day_timeline.events ] do %> +<% cache [ day_timeline.events, Time.zone.name ] do %> <%# Template Dependency Updated: _layout.html.erb 2026-01-26 %> <% if day_timeline.has_activity? %>