Skip to content

fix: hydration mismatch from client-server date differences #23

@anxkhn

Description

@anxkhn

Problem Description

Date formatting can cause hydration mismatches when server and client render different relative times.

Context

Relative time strings like 'in 2 days' may differ between server render and client hydration.

Files to Investigate

  • src/lib/date-utils.ts - getRelativeTime function
  • src/components/event-card.tsx - Time display

Steps to Reproduce

  1. View events list page
  2. Check browser console for hydration warnings
  3. Relative times may differ by seconds

Expected Behavior

Date formatting should not cause hydration mismatches.

Acceptance Criteria

  • No hydration warnings in console
  • Dates render consistently
  • Consider suppressing hydration for time elements
  • Or use client-only rendering for relative times

Suggested Approach

Use suppressHydrationWarning or render dates client-side only with useEffect.

Difficulty: Hard

Estimated time: 3-6 hours
Prerequisites: React hydration, SSR concepts
Learning outcomes: SSR best practices, hydration debugging

Metadata

Metadata

Assignees

No one assigned

    Labels

    advancedComplex challenge (3-6 hours)bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions