From a4c692f6cb1b8bf4c47ea012872af5ce93382fbf Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Thu, 16 Jan 2025 01:46:43 -0800 Subject: [PATCH] fix: convert refreshed_at to UTC before updating (#1916) --- 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") }