Bug: date on contract signing page doesn't work — SSR/timezone mismatch #9

Closed
opened 2026-03-24 19:47:00 +00:00 by forgejo_admin · 1 comment

Type

Bug

Lineage

plan-wkq → Phase 14 (Billing Tiers & Contracts) — discovered during E2E validation

Repo

forgejo_admin/westside-contracts

What Broke

The date shown on the contract signing page is not functioning correctly. The date is computed in +page.svelte line 25 as:

const dateStr = new Date().toLocaleDateString('en-US', {
    year: 'numeric',
    month: 'long',
    day: 'numeric'
});

This runs during SSR on the server (UTC timezone in the k8s pod). SvelteKit adapter-node renders on the server first, then hydrates on the client. The const is not reactive — Svelte reuses the SSR-computed value during hydration and does NOT re-compute it with the client's local timezone.

This means:

  • After 6 PM MDT (midnight UTC), the date shows tomorrow's date for Utah users
  • The date field in the signing section and the success overlay both use this SSR-computed value
  • The contract_signed_at in the DB is correct (server UTC timestamp), but the DATE DISPLAYED TO THE USER may be wrong

Repro Steps

  1. Open any contract page after 6 PM MDT (midnight UTC)
  2. Check the "I agree" checkbox to reveal the signing section
  3. Look at the Date field — shows tomorrow's date
  4. Sign the contract — success overlay shows wrong date

Expected Behavior

Date field should always show the user's local date, not the server's UTC date.

Environment

  • Cluster/namespace: prod / westside-contracts
  • Service version/commit: 56d81b7 (current main)
  • Related alerts: none

Acceptance Criteria

  • Date field shows user's local date, not server UTC date
  • Works correctly on mobile (90%+ of users will be on mobile)
  • Success overlay shows correct local date
  • No hydration mismatch between SSR and client
  • project-westside-basketball — project this affects
  • forgejo_admin/westside-contracts #7 — E2E validation (this blocks sign-off)
### Type Bug ### Lineage `plan-wkq` → Phase 14 (Billing Tiers & Contracts) — discovered during E2E validation ### Repo `forgejo_admin/westside-contracts` ### What Broke The date shown on the contract signing page is not functioning correctly. The date is computed in `+page.svelte` line 25 as: ```javascript const dateStr = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); ``` This runs during SSR on the server (UTC timezone in the k8s pod). SvelteKit adapter-node renders on the server first, then hydrates on the client. The `const` is not reactive — Svelte reuses the SSR-computed value during hydration and does NOT re-compute it with the client's local timezone. This means: - After 6 PM MDT (midnight UTC), the date shows **tomorrow's date** for Utah users - The date field in the signing section and the success overlay both use this SSR-computed value - The `contract_signed_at` in the DB is correct (server UTC timestamp), but the DATE DISPLAYED TO THE USER may be wrong ### Repro Steps 1. Open any contract page after 6 PM MDT (midnight UTC) 2. Check the "I agree" checkbox to reveal the signing section 3. Look at the Date field — shows tomorrow's date 4. Sign the contract — success overlay shows wrong date ### Expected Behavior Date field should always show the user's local date, not the server's UTC date. ### Environment - Cluster/namespace: prod / westside-contracts - Service version/commit: `56d81b7` (current main) - Related alerts: none ### Acceptance Criteria - [ ] Date field shows user's local date, not server UTC date - [ ] Works correctly on mobile (90%+ of users will be on mobile) - [ ] Success overlay shows correct local date - [ ] No hydration mismatch between SSR and client ### Related - `project-westside-basketball` — project this affects - `forgejo_admin/westside-contracts #7` — E2E validation (this blocks sign-off)
Author
Owner

Scope Review: READY

Review note: review-331-2026-03-24
Scope is solid — file targets verified, acceptance criteria testable, no blast radius in sibling services. Fix already implemented in PR #10 (branch fix/9-contract-date-timezone). Minor line number off-by-one (issue says line 25, actual is line 24) — cosmetic, does not affect agent execution.

## Scope Review: READY Review note: `review-331-2026-03-24` Scope is solid — file targets verified, acceptance criteria testable, no blast radius in sibling services. Fix already implemented in PR #10 (branch `fix/9-contract-date-timezone`). Minor line number off-by-one (issue says line 25, actual is line 24) — cosmetic, does not affect agent execution.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/westside-contracts#9
No description provided.