fix(group-wizard): use MP-TZ for Start_Date default#17
Merged
Conversation
- setup.ts step 9: default the storedprocs prompt to true (was false); drop "(optional)" from step name; print a one-line context message explaining what the reference is used for (Claude Code stored-proc suggestions) - README.md: wizard description now says "Generate the stored procedure reference (powers Claude Code suggestions)" instead of "Optionally generate..."; rename manual setup section to "Regenerate Ministry Platform Types" and note that models ship pre-generated so a fresh clone can build immediately — regeneration is for picking up your own MP instance's custom schema; mention the storedprocs script alongside Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The wizard's Start_Date default was built at module load with
`new Date().toISOString().split('T')[0]`, which returns today in
the browser's UTC offset. For an MP domain east of UTC late at
night (or west of UTC at any evening hour past the MP-TZ rollover),
the form pre-populated with tomorrow's MP-TZ date.
- schema.ts: clear `GROUP_WIZARD_DEFAULTS.Start_Date` and add a
`buildGroupWizardDefaults(mpTimezone)` factory that formats today
via `Intl.DateTimeFormat({ timeZone })`.
- index.ts: re-export the factory.
- page.tsx: await `getMpTimezone()` and pass to <GroupWizard>.
- group-wizard.tsx: accept `mpTimezone` prop, call the factory for
`defaultValues` and `handleCreateAnother` reset.
- schema.test.ts: cross-zone correctness check (UTC vs +14 zone).
- group-wizard.test.tsx: supply `mpTimezone` to 10 render sites.
- helper.ts JSDoc + docs/README.md: replace
`Contact_Date: new Date().toISOString()` example with
`await tz.toMpSqlDatetime(new Date())` so future contributors
don't copy the anti-pattern.
Tests: +3 new factory tests, full suite 667/667 passes under
TZ=UTC and TZ=America/Los_Angeles.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The group wizard's
Start_Datedefault was computed at module load vianew Date().toISOString().split('T')[0]— today in UTC. For an MP domain east of UTC late at night, or west of UTC any evening past the MP-TZ rollover, the form pre-populated with tomorrow's MP-TZ date. This closes the one remaining MP-bound anti-pattern site that PR #15 left behind.buildGroupWizardDefaults(mpTimezone)factory formats today viaIntl.DateTimeFormat({ timeZone })in the MP domain's IANA zone.page.tsxnow awaitsgetMpTimezone()and threads it to<GroupWizard>(Recipe C from the playbook).helper.tsJSDoc anddocs/README.mdupdated so theContact_Date: new Date().toISOString()example no longer steers contributors back into the anti-pattern.Commits in this PR
Three commits — only the last is part of this fix:
a22f550— adds the date/time handling playbook (.claude/playbooks/port-mp-datetime-handling.md) that drove the work.018aabd— unrelated setup wizard polish, already on localmainand bundled to ship together.ca059b4— the actualStart_Datefix.Test plan
npm run test:run— full suite 667/667 pass (+3 new factory tests).npm run lint— clean.npx tsc --noEmit— only pre-existing errors in unrelated test files (helper.test.ts,provider.test.ts,logger.test.ts,word-document.test.ts); none touched here.TZ=UTCandTZ=America/Los_Angeles(52/52 each).T00:00:00Z/.toISOString()/new Date(...).get*()sites insrc/.🤖 Generated with Claude Code