Skip to content

All-day events returned for two days when querying with date objects #178

@fzellini

Description

@fzellini

When calling events with start = end = date objects, all-day events are returned for two days instead of one.
I believe the issue is in icalparser.py, around line 443.
Current logic includes events when:
e.end >= f and e.start <= t
This causes an all-day event to be included on the following day as well.

Example
I have a daily all-day event for 2025-12-12:
e.start = 2025-12-12 00:00
e.end = 2025-12-13 00:00

When querying events for 2025-12-13, the event is still returned because:
e.end >= f # True (2025-12-13 00:00 >= 2025-12-13 00:00)

This results in the event being reported for both Dec 12 and Dec 13, even though it should only appear on Dec 12.
Proposed fix

Exclude all-day events whose end exactly matches the query start:

elif e.end >= f and e.start <= t and is_not_exception(e.start):
if not (e.all_day and e.end == f):
found.append(e)

With this change, all-day events are correctly reported only for the intended day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions