NOW() returns TIMESTAMPTZ. The pattern (NOW() AT TIME ZONE 'UTC' AT TIME ZONE $userTz)::date double-converts: first strips the tz designation (keeping UTC wall-clock as naive TIMESTAMP), then re-interprets that wall-clock as user-local (pushing UTC into the user-tz's UTC equivalent). For non-UTC users this gives the WRONG date — e.g. NY user at 9pm sees "today = tomorrow's UTC date", so opened-today returns 0. The column-side pattern ((col AT TIME ZONE 'UTC') AT TIME ZONE $userTz) is correct because the columns are TIMESTAMP without TZ (stored as UTC) — only the NOW() side was buggy. Replace with (NOW() AT TIME ZONE $userTz) everywhere. Affects: dashboard overview/trends, mobile dashboard/engagement/finance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| analyzer/feed | ||
| dashboard | ||
| engagement | ||
| finance | ||
| tickets | ||