Skip to content

Conversation

@eswan18
Copy link
Owner

@eswan18 eswan18 commented Feb 6, 2026

Summary

  • All dates across the app now display in the user's browser timezone instead of UTC
  • Added getBrowserTimezone() helper that detects the browser's timezone via Intl.DateTimeFormat
  • Centralized date formatting into formatDate() and formatDateTime() in lib/time-utils.ts, both accepting an optional timezone parameter (defaulting to UTC)
  • Created <LocalDate> client component for timezone-aware dates in server components (with suppressHydrationWarning for the intentional server/client mismatch)
  • Updated 9 components to use the new timezone-aware formatting

Approach

Uses browser-native Intl.DateTimeFormat().resolvedOptions().timeZone for detection — no database column or user settings needed. Server-rendered pages show UTC initially, then hydrate to the user's local timezone via the <LocalDate> client component.

Test plan

  • Unit tests for formatDate and formatDateTime (4 tests in lib/time-utils.test.ts)
  • All 163 existing tests pass
  • TypeScript type checking passes
  • ESLint passes
  • Manual: verify dates display in local timezone on competitions page, competition detail, admin pages, and landing page

🤖 Generated with Claude Code

eswan18 and others added 25 commits February 5, 2026 19:49
Add nullable varchar(50) timezone column to store user's preferred
timezone as IANA timezone strings (e.g., "America/New_York").
Updates v_users view to include the new timezone column.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update formatDate and formatDateTime to accept an optional timezone
parameter that defaults to UTC. The formatDateTime function now
dynamically displays the timezone abbreviation instead of hardcoding UTC.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add TimezoneSettings React component that allows users to select
their preferred timezone from a dropdown. Uses React Hook Form
with Zod validation and integrates with the existing updateUser
server action.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the UpcomingDeadlines component to format deadline dates
using the user's preferred timezone from their profile settings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the CompetitionPropView component to format forecast and
resolution due dates using the user's preferred timezone.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Convert ResolvedPropCard to a client component and update
resolution date display to use the user's preferred timezone.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace date-fns format() calls with timezone-aware formatDate()
and formatDateTime() functions from time-utils.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use the authenticated user's timezone preference for displaying
competition dates in the server-rendered competitions list page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the admin competition row component to format competition
dates using the user's preferred timezone from their profile.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
…tart-end

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
…onents

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
forecasting Ready Ready Preview, Comment Feb 6, 2026 2:42am

…ed-prop-card to server component

- Renamed useUserTimezone to getBrowserTimezone since it's a plain function,
  not a React hook
- Reverted resolved-prop-card.tsx to a server component by using <LocalDate>
  instead of the hook directly, reducing client bundle size
- Restored missing blank line in account-details.tsx

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Server renders UTC, client renders browser timezone — the mismatch is
intentional, so suppressHydrationWarning is the correct approach.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@eswan18 eswan18 merged commit 8166481 into main Feb 6, 2026
3 checks passed
@eswan18 eswan18 deleted the feat/user-timezone-preference branch February 6, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant