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 work for event with higher SEQUENCE #148

Closed
zoifar opened this issue Jul 8, 2024 · 8 comments
Closed

bug: EXDATE does not work for event with higher SEQUENCE #148

zoifar opened this issue Jul 8, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@zoifar
Copy link

zoifar commented Jul 8, 2024

Describe the bug

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

To Reproduce

ical_string="""BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20240707T214014Z
DTSTART;VALUE=DATE:20240701
DTEND;VALUE=DATE:20240708
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
CREATED:20240311T051101Z
LAST-MODIFIED:20240311T051101Z
SEQUENCE:1
END:VEVENT

BEGIN:VEVENT
DTSTAMP:20240707T214014Z
DTSTART;VALUE=DATE:20240701
DTEND;VALUE=DATE:20240708
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
EXDATE;VALUE=DATE:20240715
CREATED:20240311T051101Z
LAST-MODIFIED:20240701T063743Z
SEQUENCE:2
END:VEVENT
END:VCALENDAR"""
calendar = icalendar.Calendar.from_ical(ical_string)
events=recurring_ical_events.of(calendar).at(2024)

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:20240707T214014Z
DTSTART;VALUE=DATE:20240701
DTEND;VALUE=DATE:20240708
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
CREATED:20240311T051101Z
LAST-MODIFIED:20240311T051101Z
SEQUENCE:1
END:VEVENT

BEGIN:VEVENT
DTSTAMP:20240707T214014Z
DTSTART;VALUE=DATE:20240701
DTEND;VALUE=DATE:20240708
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
EXDATE;VALUE=DATE:20240715
CREATED:20240311T051101Z
LAST-MODIFIED:20240701T063743Z
SEQUENCE:2
END:VEVENT
END:VCALENDAR

Expected behavior

only events from SEQUENCE:2 are returned:

start 2024-07-01 duration 7 days, 0:00:00
start 2024-07-29 duration 7 days, 0:00:00

Console output

start 2024-07-15 duration 7 days, 0:00:00
start 2024-07-01 duration 7 days, 0:00:00
start 2024-07-29 duration 7 days, 0:00:00

Version:

2.2.1

Additional context

This is generated by atlassian confluence calendar when multiple instances of an event are modified.


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 Jul 8, 2024
@niccokunzmann
Copy link
Owner

Thanks! This is a nice catch of an edge case!

@niccokunzmann
Copy link
Owner

niccokunzmann commented Jul 9, 2024

For more edge cases:

  • EDGE CASE 1 What does the confluence calendar do when the following is imported:
  1. event made (3x, each 2 weeks)
  2. event in middle moved
  3. base event edited
import icalendar, recurring_ical_events
ical_string="""BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20240707T214014Z
DTSTART;VALUE=DATE:20240701
DTEND;VALUE=DATE:20240708
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
CREATED:20240311T051101Z
LAST-MODIFIED:20240311T051101Z
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
RECURRENCE-ID;VALUE=DATE:20240715
DTSTAMP:20240707T214014Z
DTSTART;VALUE=DATE:20240702
DTEND;VALUE=DATE:20240709
SUMMARY:test123 - edited event!!!!
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
CREATED:20240311T051101Z
LAST-MODIFIED:20240311T051101Z
SEQUENCE:2
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20240707T214014Z
DTSTART;VALUE=DATE:20240701
DTEND;VALUE=DATE:20240708
SUMMARY:test123
CATEGORIES:other
UID:111
ORGANIZER:aaa
RRULE:FREQ=WEEKLY;UNTIL=20240801;INTERVAL=2;BYDAY=MO
EXDATE;VALUE=DATE:20240715
CREATED:20240311T051101Z
LAST-MODIFIED:20240701T063743Z
SEQUENCE:3
END:VEVENT
END:VCALENDAR
"""
calendar = icalendar.Calendar.from_ical(ical_string)
events=recurring_ical_events.of(calendar).at(2024)

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

current output:

start 2024-07-02 duration 7 days, 0:00:00
start 2024-07-01 duration 7 days, 0:00:00
start 2024-07-29 duration 7 days, 0:00:00
  • EDGE CASE 2 There is another edge case, too: What does the calendar show if you remove this line and import it:
EXDATE;VALUE=DATE:20240715

Can you import this and check?

niccokunzmann added a commit that referenced this issue Jul 9, 2024
@niccokunzmann niccokunzmann mentioned this issue Jul 9, 2024
4 tasks
@zoifar
Copy link
Author

zoifar commented Jul 9, 2024

Tested 1st case in confluence:

start 2024-07-01 duration 7 days, 0:00:00
start 2024-07-29 duration 7 days, 0:00:00

Also tested 1st case in microsoft and apple:

start 2024-07-02 duration 7 days, 0:00:00
start 2024-07-01 duration 7 days, 0:00:00
start 2024-07-29 duration 7 days, 0:00:00

Tested 2nd case in confluence, microsoft and apple:

start 2024-07-02 duration 7 days, 0:00:00
start 2024-07-01 duration 7 days, 0:00:00
start 2024-07-29 duration 7 days, 0:00:00

@niccokunzmann
Copy link
Owner

@zoifar Do I see this correctly that confluence and differs from Microsoft and Apple in EDGE CASE 1?

@zoifar
Copy link
Author

zoifar commented Jul 9, 2024

Just tested 1st case in confluence cloud. Looks like they fixed something in their cloud version of confluence and now it shows the same events as microsoft and apple.

@niccokunzmann
Copy link
Owner

Yay!

@niccokunzmann
Copy link
Owner

This is fixed in #149.

@niccokunzmann
Copy link
Owner

This is released in v2.2.3.

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

No branches or pull requests

2 participants