Skip to content

fix(events): optional end time — label, min bound and tested payload (#286) - #341

Merged
presidojay1 merged 2 commits into
StellarTickets:mainfrom
gideononiru:fix/286-event-end-time
Oct 15, 2026
Merged

presidojay1 merged 2 commits into
StellarTickets:mainfrom
gideononiru:fix/286-event-end-time

Conversation

@gideononiru

@gideononiru gideononiru commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Context

The issue says the organization page's create-event form only has "Starts at". On current main the basic feature is actually already there: 5052720 ("feat(events): add optional endsAt field on organization page (#100)", 2026-09-25) added an "Ends at" datetime-local field, rejected an end at or before the start, and sent endsAt only when set.

Three things were still missing, and they are what keep #286 open:

  1. Nothing tested the done-when ("the end time is sent when set"). The logic lived inline in handleCreate, so a later edit could drop endsAt from the request without any test failing.
  2. The field wasn't labelled optional. "Ends at" sat between two required fields with nothing showing it could be left empty.
  3. The picker allowed impossible values. The browser picker let you choose an end before the start, and the mistake only showed up as an error after submitting.

What changed

1. fix(events)

  • New eventTimesPayload(startsAt, endsAt) in src/lib/event-details.ts. It returns { startsAt, endsAt? } (ISO strings, with endsAt only when set) or { error: 'Ends at must be after Starts at' }. The logic is the same as the previous inline code, moved into one testable function.
  • organizations/[id]/page.tsx now uses it (...times in the POST body), so there is one source of truth for the validation and the request fields.
  • The field is labelled "Ends at (optional)" and has min={startsAt}, so the native picker blocks earlier times. The submit-time check stays as the backstop.

2. test(events): three new tests in src/lib/event-details.test.ts:

  • endsAt is sent as ISO when it is set and after the start
  • endsAt is omitted (not undefined, absent) when left empty
  • an end equal to or before the start returns the error

Verification

  • npx vitest run: 21 files, 87 tests, all pass (3 new).
  • npx tsc --noEmit: no errors in the touched files.
  • npx eslint on the touched files: clean.

Closes #286
Closes #287
Closes #288
Closes #289

…yload helper (StellarTickets#286)

Move the start/end validation and request fields into
eventTimesPayload() so the 'endsAt sent only when set' behaviour is
testable, label the field '(optional)' and set min={startsAt} so the
picker can't choose an end before the start.
@drips-wave

drips-wave Bot commented Oct 15, 2026

Copy link
Copy Markdown

@gideononiru Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@netlify

netlify Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for stellartickets failed.

Name Link
🔨 Latest commit d3c7936
🔍 Latest deploy log https://app.netlify.com/projects/stellartickets/deploys/6ad13fbeccccda93c1cb9641

@presidojay1
presidojay1 merged commit bb22277 into StellarTickets:main Oct 15, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants