Skip to content

Default event form dates to today with end matching start#304

Merged
dgershman merged 1 commit into
mainfrom
feature/mayo-301-default-dates
Jul 9, 2026
Merged

Default event form dates to today with end matching start#304
dgershman merged 1 commit into
mainfrom
feature/mayo-301-default-dates

Conversation

@dgershman

Copy link
Copy Markdown
Contributor

Closes #301

What & why

The public event submission form ([mayo_event_form]) started with blank Start Date and End Date fields. Issue #301 asked to default the End Date to the Start Date and to default the start year to the current year.

Changes (assets/js/src/components/public/EventForm.js)

  • Start Date pre-fills to today's date (delivers the current year; a native <input type="date"> can't default only the year). Uses a local-time getTodayLocalDate() helper — not toISOString() — to avoid a UTC off-by-one.
  • End Date matches Start Date out of the box, and follows it whenever the Start Date changes — but only while the two are still equal, so a deliberately different multi-day end date is never clobbered.
  • The post-submit form reset restores the same today-based defaults.

No PHP changed. readme.txt changelog updated under the unreleased = 1.9.2 = section (no version bump). The package-lock.json diff is just a stale 1.9.1 → 1.9.2 version sync with package.json.

Testing

  • npm run build compiles cleanly.
  • Manual: on load both dates show today; changing Start Date updates End Date to match; after setting a later End Date, changing Start Date leaves it intact; submitting resets both to today.

Pre-fill the public submission form's Start Date to today's date (giving
the current year) and initialize End Date to match. When the Start Date
changes, the End Date follows it as long as the two are still in sync, so
a deliberately different (multi-day) end date is preserved. The post-submit
reset restores the same today-based defaults.

🐦‍⬛ Generated with Claude Code, orchestrated by Crow

Co-Authored-By: Claude <noreply@anthropic.com>
Crow-Session: B1805E25-C75C-4A71-8A30-83AB0F302A81
Claude-Session: https://claude.ai/code/session_01PnvbpjMGn3C5MxoN7iPUcY
@dgershman dgershman force-pushed the feature/mayo-301-default-dates branch from c83ca34 to 5f173cb Compare July 9, 2026 23:08
@dgershman dgershman merged commit 7902ad7 into main Jul 9, 2026
3 checks passed
@dgershman dgershman deleted the feature/mayo-301-default-dates branch July 9, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should you default Dates?

1 participant