fix(02): day-view 400, invalid date display, duplicate popover (BUG 2-4)

- BUG 2: onRangeUpdate sets exclusive end = range.end + 1 day so day view
  sends a 1-day window (start < end, no 400) and week/month include the last day
- BUG 3: formatDateTime strips IANA bracket '[Zone]' before new Date() to prevent
  'Invalid Date, Invalid Date – Invalid Date' in event popover; regression test added
- BUG 4: remove createEventModalPlugin + customComponents.eventModal — keep only
  the Zustand-driven standalone EventDetailPopover to prevent double-open fight
This commit is contained in:
Lucas Berger
2026-06-05 14:34:36 -04:00
parent ee2281fe81
commit 1a24b00de9
3 changed files with 45 additions and 15 deletions
+12 -4
View File
@@ -48,7 +48,11 @@ interface ScheduleXEventModalProps {
/**
* Format a start/end pair for display.
* Handles both timed (ISO with tz) and all-day (YYYY-MM-DD) strings.
* Handles both timed (IANA-annotated ISO e.g. '2026-06-18T08:00:00-04:00[America/Toronto]')
* and all-day ('YYYY-MM-DD') strings.
*
* The IANA bracket suffix '[Zone]' is stripped before passing to new Date() because
* the built-in Date constructor cannot parse it and returns Invalid Date (BUG 3).
*/
function formatDateTime(start: string, end: string, allDay: boolean): string {
if (allDay) {
@@ -65,10 +69,14 @@ function formatDateTime(start: string, end: string, allDay: boolean): string {
return start
}
}
// Timed — parse offset-aware ISO string
// Timed — parse offset-aware ISO string.
// Strip trailing IANA bracket e.g. '[America/Toronto]' before passing to new Date():
// new Date() cannot parse the bracket notation and returns Invalid Date.
try {
const startDate = new Date(start)
const endDate = new Date(end)
const cleanStart = start.replace(/\[[^\]]*\]$/, '')
const cleanEnd = end.replace(/\[[^\]]*\]$/, '')
const startDate = new Date(cleanStart)
const endDate = new Date(cleanEnd)
const dateStr = startDate.toLocaleDateString(undefined, {
weekday: 'short',
month: 'long',