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)