Review: Bug: date doesn't work on contract page — SSR/timezone

review-331-2026-03-24 Review

review ready

Verdict: READY

Template Completeness

  • [x] Type — present ("Bug")
  • [x] Lineage — present (plan-wkq → Phase 14)
  • [x] Repo — present (forgejo_admin/westside-contracts)
  • [ ] User Story — missing (uses "What Broke" instead, acceptable for bug type)
  • [x] Context — covered by "What Broke" section with detailed SSR/hydration explanation
  • [x] File Targets — inline code reference to +page.svelte line 25, no formal section but sufficient
  • [x] Acceptance Criteria — 4 criteria, all testable
  • [ ] Test Expectations — missing (no test commands specified)
  • [ ] Constraints — missing
  • [ ] Checklist — missing
  • [x] Related — present (project + blocking issue)
  • [x] Repro Steps — present, clear and specific
  • [x] Expected Behavior — present
  • [x] Environment — present (cluster, namespace, commit)
Missing sections are non-critical for a 1-point bug fix. The "What Broke" section is thorough enough to serve as both context and file targets.

File Targets

  • [x] src/routes/contract/[token]/+page.svelte line 24 (main branch) — verified: const dateStr = new Date().toLocaleDateString('en-US', ...) exists as a module-level const, confirming the SSR bug. The issue says "line 25" which is off by one (it is line 24), but the code pattern is exactly as described.
  • [x] Success overlay (line 494 on main) uses same dateStr — verified: Signed on {dateStr} confirms both display locations are affected as the issue states.
  • [x] "Already signed" view (line 156) uses new Date(player.contract_signed_at).toLocaleDateString(...) — this is a DIFFERENT pattern (formats stored timestamp, not new Date()), not affected by this bug.

Repo Placement

Correct. The bug is in westside-contracts and the Forgejo issue is filed on westside-contracts. No cross-repo impact. Searched westside-app for the same new Date().toLocaleDateString pattern — zero matches.

Dependencies

  • Board item #330 ("E2E: Lucas + Marcus walk through contract flow") is in next_up and depends on this bug being fixed (label: blocks:contracts). This is correctly documented via labels.
  • No upstream blockers for this item. It can be fixed independently.
  • Phase 14 (board item #131) is in_progress. This bug is one of several items blocking contract rollout.

Acceptance Criteria

All 4 criteria are verifiable by an agent:
  • "Date field shows user's local date, not server UTC date" — testable via Playwright with timezone override
  • "Works correctly on mobile" — testable via Playwright mobile viewport
  • "Success overlay shows correct local date" — testable by signing and checking overlay
  • "No hydration mismatch between SSR and client" — testable by checking browser console for hydration warnings
Missing: no explicit test command. For a SvelteKit component, this would be a Playwright E2E test rather than a unit test — acceptable given the UI-only nature of the fix.

Blast Radius

  • No similar new Date().toLocaleDateString pattern found in westside-app.
  • The "already signed" view uses a stored timestamp, not new Date() — not affected.
  • No downstream consumers of the date display value.
  • The fix (moving to onMount) means SSR renders empty string, then client fills in. This could cause a brief flash of empty date field on slow connections. Cosmetic, not a blocker.

Implementation Status

Note: A fix has already been implemented on branch fix/9-contract-date-timezone (commit f176c01) with PR #10 open. The fix moves dateStr from a module-level const to $state('') initialized in onMount(). This correctly addresses the SSR/timezone mismatch.

Recommendation

No action needed on scope. The issue is well-scoped, the file targets are accurate, and the fix is already implemented in PR #10. Review and merge PR #10 to close this item.