From bc8ec43219802f38702cfaec001253d3528ed128 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Wed, 15 Jan 2025 18:20:25 -0800 Subject: [PATCH] fix: convert refreshed_at to UTC before updating --- internal/models/sessions.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/models/sessions.go b/internal/models/sessions.go index b909264b22..a93be44ac3 100644 --- a/internal/models/sessions.go +++ b/internal/models/sessions.go @@ -103,6 +103,10 @@ func (s *Session) LastRefreshedAt(refreshTokenTime *time.Time) time.Time { } func (s *Session) UpdateOnlyRefreshInfo(tx *storage.Connection) error { + // TODO(kangmingtay): The underlying database type uses timestamp without timezone, + // so we need to convert the value to UTC before updating it. + // In the future, we should add a migration to update the type to contain the timezone. + *s.RefreshedAt = s.RefreshedAt.UTC() return tx.UpdateOnly(s, "refreshed_at", "user_agent", "ip") }