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
@@ -190,4 +190,27 @@ describe('EventDetailPopover', () => {
expect(descEl.innerHTML).not.toContain('<b>')
expect(descEl.textContent).toContain('<b>Bold</b> description')
})
it('BUG-3 regression: IANA-bracketed start/end does not produce "Invalid Date" in rendered output', () => {
// Fastmail events are serialized with IANA bracket notation e.g. '2026-06-18T08:00:00-04:00[America/Toronto]'.
// new Date() cannot parse the bracket, so the date/time line showed "Invalid Date, Invalid Date Invalid Date".
// After the fix, the bracket is stripped before parsing.
const occurrence: CalendarOccurrence = {
...TIMED_OCCURRENCE,
id: 'iana-bracket-uid::1718712000000',
uid: 'iana-bracket-uid',
start: '2026-06-18T08:00:00-04:00[America/Toronto]',
end: '2026-06-18T09:00:00-04:00[America/Toronto]',
}
renderPopover(occurrence)
// The date/time text must not contain 'Invalid Date'
const dialogEl = screen.getByRole('dialog')
expect(dialogEl.textContent).not.toContain('Invalid Date')
// It must contain recognizable date content (month name or a digit)
// toLocaleDateString output varies by locale; check for a digit at minimum
const dateTimeText = dialogEl.textContent ?? ''
expect(dateTimeText).toMatch(/\d/)
})
})