Skip to content

fix(calendar): handle multi-day events and isolate lanes per day (#1755) - #1902

Open
VishalDhariwal wants to merge 2 commits into
thunderbird:mainfrom
VishalDhariwal:fix/1755-multiday-calendar-events
Open

VishalDhariwal wants to merge 2 commits into
thunderbird:mainfrom
VishalDhariwal:fix/1755-multiday-calendar-events

Conversation

@VishalDhariwal

Copy link
Copy Markdown
Contributor

What changed?

  • Daily Event Slicing: Added splitEventIntoDaySegments in frontend/src/utils.ts to break multi-day and overnight events into day-bounded slices ([start, 24:00], [00:00, 24:00], and [00:00, end]).
  • Multi-Day Grid Placement & Clamping: Updated filteredRemoteEventsForGrid and filteredPendingAppointmentsForGrid in WeekCalendar.vue to include events overlapping the active week (not just those starting in it) and map each daily slice into its respective weekday column.
  • Grid Overflow Prevention: In calculateEventGridPosition, bounded durationMinutes to the remaining minutes of that day, ensuring event blocks terminate cleanly at midnight (24:00) without breaking past the 24-hour grid.
  • Per-Day Lane Isolation: Grouped events by gridColumn before calling assignEventLanes, isolating lane assignments to each day column. Events crossing midnight or spanning multiple days no longer shrink unrelated events on adjacent days.
  • Preserved Full Timeframe on Hover: Preserved originalStart and originalEnd on event segments so EventPopup displays the full multi-day event timeframe when hovered on any day slice.
  • Automated Tests:
    • Added unit tests in frontend/test/utils.test.js covering single-day, multi-day, overnight, midnight-boundary, and out-of-week event slicing.
    • Added unit tests in frontend/test/components/WeekCalendar.test.js verifying multi-day grid position slicing, height clamping, and day lane isolation.

AI Disclosure: Implemented with the assistance of Antigravity AI agent, reviewed, tested, and verified by me.

Why?

Follows up on the limitation noted in #1882 and resolves #1755:

  1. Previously, multi-day events calculated duration as eventEnd - eventStart in raw minutes across multiple days, resulting in thousands of pixels in height on the start day that broke past the bottom of the 24-hour calendar grid, while completely disappearing on subsequent days.
  2. In addition, global lane calculation caused multi-day events to bleed across midnight into subsequent days' lane clusters, unnecessarily narrowing same-week events on other days into 50% width lanes.

Limitations and Notes

None. All-day events remain in the header row, and timed grid events now correctly slice across day columns and terminate cleanly at the midnight grid line.

Applicable Issues

Closes #1755

QA Log

  • Verified all unit tests pass via pnpm run test test/components/WeekCalendar.test.js test/utils.test.js (21/21 passing).
  • Verified pnpm run lint passes with 0 errors and 0 warnings.
  • Verified in local browser (http://localhost:8090/calendar) using multi-day events (e.g. Tuesday 09:00 to Thursday 15:00) alongside single-day events (Thursday 10:00 to 11:30):
    • Multi-day event appears across Tuesday, Wednesday, and Thursday columns.
    • Tuesday and Wednesday slices terminate cleanly at the midnight grid boundary with no bottom overflow.
    • Thursday 10:00 event shares the column side-by-side with Thursday's slice without causing Tuesday or Wednesday events to narrow.

Screenshots

Before (Overflows 24h grid on start day, missing on Wed & Thu, narrows Thu event)

| Overview / Morning | Scrolled to 11 PM (Bottom Overflow) |
Screenshot 2026-11-19 at 8 54 38 AM

After (Properly sliced across Tue, Wed, & Thu; lane isolation on Thu; clean midnight boundary)

| Overview / Sliced Days | Scrolled to 11 PM (Clean Midnight Boundary) |
Screenshot 2026-11-19 at 9 11 50 AM

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with these non-blocking display issues noted.

Findings

  1. P2 Repeated-hour events collapse ▶
  2. P2 Zero-length events disappear. ▶
Fix with agent prompt
### Issue 1
frontend/src/views/DashboardView/components/WeekCalendar.vue:158-166
**Repeated-hour events collapse.** In London on October 25, 2026, a booking from `01:30+01:00` to `01:15+00:00` lasts 45 minutes. Subtracting clock minutes gives −15 here, which is clamped to zero and draws only the minimum-height block. The previous elapsed-time calculation preserved its duration. Keep the wall-clock calculation for ordinary slices, but handle positive-duration bookings that cross the repeated hour separately and add a fall-back test.

### Issue 2
frontend/src/utils.ts:434-435
This check drops events whose start and end are equal. Google events pass through without a positive-duration requirement, so a timed reminder with equal endpoints reaches this helper and now vanishes from the calendar. Previously it reached `calculateEventGridPosition` and drew a block. Keep equal-endpoint events as a single visible block while rejecting reversed dates.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR splits timed events across calendar days, keeps overlapping event widths separate per day, and preserves full event times on hover.

  • Timed events appear as day-sized blocks in every day they overlap.
  • Events on different days keep separate lane widths.
  • All-day events appear on each date in their calendar range.

Reviews (2) · Last reviewed commit: "fix(calendar): address review findings a..." · Reviewed by Greptile

Comment thread frontend/src/utils.ts Outdated
Comment on lines +434 to +435
if (!eventStart.isValid() || !eventEnd.isValid() || !eventStart.isBefore(eventEnd)) {
return [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Zero-length events disappear. This check drops events whose start and end are equal. Google events pass through without a positive-duration requirement, so a timed reminder with equal endpoints reaches this helper and now vanishes from the calendar. Previously it reached calculateEventGridPosition and drew a block. Keep equal-endpoint events as a single visible block while rejecting reversed dates.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/utils.ts
Line: 434-435

Comment:
**Zero-length events disappear.** This check drops events whose start and end are equal. Google events pass through without a positive-duration requirement, so a timed reminder with equal endpoints reaches this helper and now vanishes from the calendar. Previously it reached `calculateEventGridPosition` and drew a block. Keep equal-endpoint events as a single visible block while rejecting reversed dates.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@sonarqubecloud

Copy link
Copy Markdown

Comment on lines +158 to +166
const endMinutesTotal = eventStart.isSame(eventEnd, 'day')
? eventEnd.hour() * 60 + eventEnd.minute()
: 24 * 60;

let durationMinutes = endMinutesTotal - startMinutesTotal;
const maxRemainingMinutesInDay = 24 * 60 - startMinutesTotal;

if (durationMinutes < 0) {
durationMinutes = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Repeated-hour events collapse. In London on October 25, 2026, a booking from 01:30+01:00 to 01:15+00:00 lasts 45 minutes. Subtracting clock minutes gives −15 here, which is clamped to zero and draws only the minimum-height block. The previous elapsed-time calculation preserved its duration. Keep the wall-clock calculation for ordinary slices, but handle positive-duration bookings that cross the repeated hour separately and add a fall-back test.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/views/DashboardView/components/WeekCalendar.vue
Line: 158-166

Comment:
**Repeated-hour events collapse.** In London on October 25, 2026, a booking from `01:30+01:00` to `01:15+00:00` lasts 45 minutes. Subtracting clock minutes gives −15 here, which is clamped to zero and draws only the minimum-height block. The previous elapsed-time calculation preserved its duration. Keep the wall-clock calculation for ordinary slices, but handle positive-duration bookings that cross the repeated hour separately and add a fall-back test.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

This branch has not been deployed

No deployments
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.

Events spanning multiple days exceed the calendar grid

1 participant