fix: sync timezone fix
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user