brackt/app/components
Chris Parsons 67c7de1924
Fix event date timezone bugs (UTC rollover + same-day status) (#148)
* Fix event date display off-by-one for late-night events in UTC-negative timezones

Events saved at 10 PM PDT (UTC-7) cross UTC midnight, so eventDate is stored
as the next UTC calendar day (e.g. March 28 10 PM PDT → eventDate "2026-03-29").
Displaying that date string via parseISO() gives March 29 local midnight, so
the events list showed "Mar 29" when the user expected "Mar 28".

Fix: when eventStartsAt is available, derive the display date from it directly
(format(new Date(eventStartsAt), ...)) rather than from the stored eventDate
string. This correctly converts the UTC timestamp to the user's local calendar
date. Date-only events (no eventStartsAt) are unchanged and continue to use
parseISO(eventDate).

Also tighten the getDisplayDate() guard: replace a misleading try/catch (new
Date() never throws) with an explicit isNaN check, and replace a non-null
assertion (eventDate!) with null-coalescing in the admin events list.

Tests cover both UTC and PDT environments and are timezone-independent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix same-day events incorrectly showing Upcoming instead of Results Pending

String date comparison (eventDate < today) is strictly less-than, so events
on the current day always showed Upcoming regardless of time. When eventStartsAt
is available, use timestamp comparison (new Date(eventStartsAt) < new Date())
for accurate past/future determination.

Fixed in three locations: admin events list (getStatusBadge call site),
admin event detail isPast check, and EventSchedule upcoming badge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 12:28:39 -07:00
..
__tests__ feat: enhance autodraft settings with detailed option descriptions an… (#56) 2026-03-02 16:26:18 -08:00
draft feat: enhance autodraft functionality with detailed settings and commissioner controls (#61) 2026-03-03 20:14:38 -08:00
scoring feat: progressive floor scoring for playoff brackets (#100) 2026-03-10 10:27:58 -07:00
sport-season Fix event date timezone bugs (UTC rollover + same-day status) (#148) 2026-03-15 12:28:39 -07:00
sports Display upcoming matches (#141) 2026-03-12 10:12:38 -07:00
standings Add rules page, rewrite how-to-play, and fix scoring display (#20) 2026-02-21 21:58:51 -08:00
ui User/chris/bracket UI redesign (#95) 2026-03-09 22:44:33 -07:00
AutodraftSettings.tsx feat: enhance autodraft functionality with detailed settings and commissioner controls (#61) 2026-03-03 20:14:38 -08:00
DraftGrid.tsx fix: address code review issues from draft board scrolling and team creation changes (#35) 2026-02-24 10:01:27 -08:00
DraftSidebar.tsx Show all draft picks in sidebar with scroll instead of last 10 (#33) 2026-02-23 22:25:28 -08:00
navbar.tsx Add favicons and logo (#62) 2026-03-04 00:23:45 -08:00
NavigationProgress.tsx Add NProgress navigation progress bar (#139) 2026-03-11 22:02:48 -07:00
NotificationSettings.tsx Add browser push notifications toggle to draft page (#11) 2026-02-20 19:30:53 -08:00
ParticipantSelector.tsx feat: Add ParticipantSelector component for improved participant selection in brackets 2025-11-08 21:36:29 -08:00
StandingsTable.tsx Add rules page, rewrite how-to-play, and fix scoring display (#20) 2026-02-21 21:58:51 -08:00