Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: EXDATE does not exclude modified event #163

Closed
zoifar opened this issue Aug 21, 2024 · 7 comments · Fixed by #165
Closed

bug: EXDATE does not exclude modified event #163

zoifar opened this issue Aug 21, 2024 · 7 comments · Fixed by #165
Labels
bug Something isn't working

Comments

@zoifar
Copy link

zoifar commented Aug 21, 2024

EXDATE does not exclude a modified instance for an event with higher SEQUENCE and the same UID.

import recurring_ical_events
import icalendar
ical_string="""BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20240820T210909Z
DTSTART;VALUE=DATE:20240729
DTEND;VALUE=DATE:20240805
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=MO
CREATED:20240311T051101Z
LAST-MODIFIED:20240311T051101Z
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20240820T210909Z
DTSTART;VALUE=DATE:20240819
DTEND;VALUE=DATE:20240822
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=MO
RECURRENCE-ID;VALUE=DATE:20240819
CREATED:20240729T132247Z
LAST-MODIFIED:20240729T132247Z
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20240820T210908Z
DTSTART;VALUE=DATE:20240729
DTEND;VALUE=DATE:20240805
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=MO
EXDATE;VALUE=DATE:20240819
CREATED:20240311T051101Z
LAST-MODIFIED:20240729T133342Z
EXDATE;VALUE=DATE:20240819
SEQUENCE:2
END:VEVENT
END:VCALENDAR
""" 


calendar = icalendar.Calendar.from_ical(ical_string)
events=recurring_ical_events.of(calendar).at([2024,8])

for event in events:
    start = event["DTSTART"].dt
    duration = event["DTEND"].dt - event["DTSTART"].dt
    print("start {} duration {}".format(start, duration))

ICS file

BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20240820T210909Z
DTSTART;VALUE=DATE:20240729
DTEND;VALUE=DATE:20240805
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=MO
CREATED:20240311T051101Z
LAST-MODIFIED:20240311T051101Z
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20240820T210909Z
DTSTART;VALUE=DATE:20240819
DTEND;VALUE=DATE:20240822
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=MO
RECURRENCE-ID;VALUE=DATE:20240819
CREATED:20240729T132247Z
LAST-MODIFIED:20240729T132247Z
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20240820T210908Z
DTSTART;VALUE=DATE:20240729
DTEND;VALUE=DATE:20240805
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=MO
EXDATE;VALUE=DATE:20240819
CREATED:20240311T051101Z
LAST-MODIFIED:20240729T133342Z
EXDATE;VALUE=DATE:20240819
SEQUENCE:2
END:VEVENT
END:VCALENDAR

Expected behavior

only non EXDATE events returned
start 2024-07-29 duration 7 days, 0:00:00

Console output

start 2024-07-29 duration 7 days, 0:00:00
start 2024-08-19 duration 3 days, 0:00:00

Version:

3.1.0

pip list                         
Package               Version
--------------------- -----------
icalendar             5.0.13
pip                   23.3.1
python-dateutil       2.9.0.post0
pytz                  2024.1
recurring-ical-events 3.1.0
setuptools            69.0.2
six                   1.16.0
tzdata                2024.1
x-wr-timezone         0.0.7

Additional context

This is generated by atlassian confluence calendar when an instance of an event is modified and deleted.


We're using Polar.sh so you can upvote and help fund this issue. We receive the funding once the issue is completed & confirmed by you. Thank you in advance for helping prioritize & fund our work. Fund with Polar
@zoifar zoifar added the bug Something isn't working label Aug 21, 2024
@niccokunzmann
Copy link
Owner

Thanks for the report!

@niccokunzmann
Copy link
Owner

@zoifar We had #148 before. I identified two edge cases for which I tested to my best understanding:

Could you check with the atlassian confluence calendar what happens at these dates?

date(2024, 7, 2)
date(2024, 7, 1)
date(2024, 7, 29)

I wonder what happens in other calendar implementations at these dates...

Outlook

edge case 1:
image

edge case 2:
image

Thunderbird

image

Edge case 1 and 2 look the same:

image

@zoifar
Copy link
Author

zoifar commented Aug 21, 2024

edge case 1:
image
edge case 2:
image

@niccokunzmann
Copy link
Owner

This is confusing me at the moment... I wonder what should be expected. I found the edge cases but the calendars handle them differently. What are your thoughts on this? Obviously these edge cases have different results.

This is the difference between the edge cases:

EXDATE;VALUE=DATE:20240715

@zoifar
Copy link
Author

zoifar commented Aug 21, 2024

The way atlassian confluence calendar handles these cases at least looks logical.
My guess is that other calendars somehow make similar changes differently and thus avoid this cases altogether.
I think the best way forward is to handle the edge cases the way atlassian confluence calendar does. At lease until some other examples popes up sourced from another calendar app.

@niccokunzmann
Copy link
Owner

This is fixed in v3.1.1.

@niccokunzmann
Copy link
Owner

Funding is appreciated if you work for a company. Thanks for the well-written issues!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants