Skip to content

fix: validate calendar event date attribution - #268

Open
anish749 wants to merge 2 commits into
mainfrom
fix/calendar-event-date-validation
Open

fix: validate calendar event date attribution#268
anish749 wants to merge 2 commits into
mainfrom
fix/calendar-event-date-validation

Conversation

@anish749

Copy link
Copy Markdown
Owner

Problem

Calendar events are currently attributed to dates using DatesForStorage(), which should handle multi-day events by returning all dates the event spans. However, the original bug description states "Right now we used a start date" — indicating there's confusion or a potential edge case with how timed events' end dates are handled.

Key concern: For timed events (not all-day events), the current implementation includes the end date as inclusive. This creates a semantic ambiguity:

  • An event ending at 2026-04-09T00:00:00Z (midnight) is still attributed to April 9
  • This may cause events to appear on dates they technically end at rather than occur on

Proposed Solution

  1. Clarify end date semantics for timed events: The end date should be treated as exclusive (like all-day events already are per Google Calendar API), so events ending at midnight are not attributed to that final date.

  2. Add validation tests: Create test cases that verify:

    • Multi-day all-day events span the correct date range
    • Timed events spanning midnight are attributed correctly
    • Events with ambiguous end times (midnight boundaries) are handled consistently
  3. Document the convention: Add doc comments clarifying that calendar events are stored across all dates they occur on, with consistent end date semantics.

Example

  • All-day event April 7-9: should be on April 7, 8 (April 9 is exclusive) ✓ Already correct
  • Timed event April 7 20:00 to April 9 00:00: should be on April 7, 8 (April 9 00:00 means event ended, not started)
  • Timed event April 7 20:00 to April 9 06:00: should be on April 7, 8, 9 ✓ Already correct

This ensures multi-day events are correctly attributed to the dates they actually occupy.

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.

1 participant