From 0d189739d6f9762a2f1144d0d8cb44fb6106249c Mon Sep 17 00:00:00 2001 From: Krispire Admin Date: Tue, 9 Jun 2026 11:56:22 +0530 Subject: [PATCH] fix: sync timezone fix --- internal/service/sadhna_service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/service/sadhna_service.go b/internal/service/sadhna_service.go index 428e4b5..2aee9db 100644 --- a/internal/service/sadhna_service.go +++ b/internal/service/sadhna_service.go @@ -85,9 +85,16 @@ const fallbackTZ = "Asia/Kolkata" // resolveTZ returns the user's IANA timezone name + loaded location, falling // back to Asia/Kolkata (then UTC) so the day boundary is always defined. +// +// The users.timezone column defaults to 'UTC' (migration 0028), so a bare +// "UTC" means the browser never reported a real zone — i.e. we don't actually +// know the user's local time. Per product intent we treat that as unknown and +// fall back to India time, rather than literally bucketing their day at UTC +// midnight (which mismatches the browser-local calendar on the client). A +// genuine UTC user re-reports their real zone on next load. func (s *SadhnaService) resolveTZ(ctx context.Context, userID string) (string, *time.Location) { tz, _ := s.logs.UserTimezone(ctx, userID) - if tz == "" { + if tz == "" || tz == "UTC" { tz = fallbackTZ } loc, err := time.LoadLocation(tz)