fix: use native date input on contract signing page for mobile #12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "11-fix-date-input-mobile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The date field on the contract signing page was
<input type="text" readonly>, which does nothing when tapped on mobile. Users thought it was broken. Changed to a nativetype="date"input withdisabledattribute so it renders correctly on all platforms.Changes
src/routes/contract/[token]/+page.svelte: Changed date input fromtype="text" readonlytotype="date" disabled, setdateStrto ISO YYYY-MM-DD format inonMount, addeddisplayDatederived value for human-readable date in the success overlayTest Plan
npm run build)player.contract_signed_atfrom server)Review Checklist
Related
Review: LGTM
Diff is minimal and scoped exactly to the issue. Verified:
dateStrnow ISOYYYY-MM-DDformat (required byinput[type=date])displayDatederived value handles timezone-safe parsing withT00:00:00suffixtype="text" readonlytotype="date" disableddisplayDatefor human-readable formatplayer.contract_signed_at) is untouchedPR #12 Review
DOMAIN REVIEW
Stack: SvelteKit, TypeScript, Svelte 5 runes (
$state,$derived,$props).This is a UX bug fix: the contract signing page date field was
<input type="text" readonly>, which renders as a dead/blank field on mobile. The fix changes it to<input type="date" disabled>so mobile browsers show a native (greyed-out) date picker, and adds adisplayDatederived value so the success overlay continues to show a human-readable date.Timezone regression on line 28:
dateStr = now.toISOString().split('T')[0]converts to UTC before extracting the date string. For a user in UTC-7 (e.g., Utah) at 11:30 PM local time,toISOString()returns the next day's date. This is the same category of bug that issue #9 / PR #10 fixed (SSR/timezone mismatch). The old code usedtoLocaleDateString()which respected the browser's local timezone. The new code introduces a UTC-dependent date that will be wrong near midnight for all negative-UTC-offset users.The fix is straightforward -- construct the ISO date string from local date components:
displayDate reconstruction (line 31):
new Date(dateStr + 'T00:00:00')parses as local time (no Z suffix), so the display conversion back to human-readable is correct. No issue here oncedateStritself is correct.Accessibility:
disabledattribute on a display-only date field is appropriate. Screen readers will announce it as disabled. No ARIA gaps.Component architecture: The
displayDatederived value is clean Svelte 5 pattern. No issues.BLOCKERS
toISOString().split('T')[0]uses UTC, not local time. This will show the wrong date for Utah users (UTC-7) between 5:00 PM and midnight local time. This directly contradicts the fix delivered in PR #10 for issue #9. Must use local date components instead.NITS
$derivedexpression across multiple lines for readability. Non-blocking.SOP COMPLIANCE
11-fix-date-input-mobilereferences #11)Closes #11)PROCESS OBSERVATIONS
signature_name,accepted,under_18,signature_dataare submitted), so this is purely a display concern. No server-side impact.toISOString()for display dates -- it should always be flagged.VERDICT: NOT APPROVED
One blocker: the
toISOString()call on line 28 uses UTC instead of local time, reintroducing a timezone-dependent date display bug for Utah users. Fix that and this is ready to merge.PR #12 Review (Re-review)
DOMAIN REVIEW
Stack: SvelteKit (Svelte 5 runes), TypeScript, client-side date handling.
Timezone fix -- VERIFIED RESOLVED. The previous review flagged
toISOString()converting to UTC, which could shift the displayed date by -1 day for users west of UTC. The fix correctly uses local date components:getFullYear(),getMonth(), andgetDate()all return values in the user's local timezone. No UTC conversion occurs. This is the correct approach.displayDatederived value -- correct.new Date(dateStr + 'T00:00:00')constructs the Date using local time (noZsuffix), so the round-trip from YYYY-MM-DD back to human-readable ("March 24, 2026") will not shift dates. This is well-handled.type="date"withdisabled-- correct. Thedisabledattribute prevents user interaction while rendering as a native date picker on mobile (the original bug). SincesubmitSignature()reads from component state (not form fields) and does not send the date to the server at all (the server usesNOW()forcontract_signed_at),disabledvsreadonlyhas no functional impact on data submission.Accessibility: The
<label for="signDate">correctly associates withid="signDate"on the input. Thedisabledattribute is semantically appropriate for a field the user should not modify. No accessibility regressions.BLOCKERS
None.
NITS
Line 34 -- long line. The
displayDatederived value is a single 140+ character line. Consider breaking it across multiple lines for readability. Non-blocking.Line 158 -- pre-existing timezone nuance (not in scope). The "already signed" view does
new Date(player.contract_signed_at).toLocaleDateString(...)wherecontract_signed_atis a PostgreSQLNOW()timestamp. If the DB timezone differs from the user's timezone, this could theoretically show a shifted date. This is pre-existing and outside this PR's scope, but worth noting for a future ticket.SOP COMPLIANCE
11-fix-date-input-mobilereferences issue #11)Closes #11)PROCESS OBSERVATIONS
Clean, minimal bugfix. Single file changed with +9/-7 lines. The fix addresses exactly the reported issue (date field unresponsive on mobile) plus the QA-flagged timezone blocker from the previous review. No scope creep. The test plan includes manual verification steps for mobile behavior, which is appropriate for a UI input type change that cannot be unit-tested without a browser environment.
VERDICT: APPROVED