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: wrong event if UNTIL< DTSTART #117

Closed
zoifar opened this issue Nov 3, 2023 · 8 comments
Closed

bug: wrong event if UNTIL< DTSTART #117

zoifar opened this issue Nov 3, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@zoifar
Copy link

zoifar commented Nov 3, 2023

Describe the bug

If UNTIL< DTSTART then a wrong event is returned.

To Reproduce

ical_string="""BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20231102T221721Z
DTSTART;VALUE=DATE:20231002
DTEND;VALUE=DATE:20231009
SUMMARY:test123
CATEGORIES:other
SUBCALENDAR-NAME:test
EVENT-ID:538924
EVENT-ALLDAY:true
RRULE:FREQ=WEEKLY;UNTIL=20231001;INTERVAL=2;BYDAY=MO
CREATED:20231102T221633Z
LAST-MODIFIED:20231102T221716Z
TRANSP:TRANSPARENT
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR"""
calendar = icalendar.Calendar.from_ical(ical_string)
events=recurring_ical_events.of(calendar).at(2023)

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:20231102T221721Z
DTSTART;VALUE=DATE:20231002
DTEND;VALUE=DATE:20231009
SUMMARY:test123
CATEGORIES:other
SUBCALENDAR-NAME:test
EVENT-ID:538924
EVENT-ALLDAY:true
RRULE:FREQ=WEEKLY;UNTIL=20231001;INTERVAL=2;BYDAY=MO
CREATED:20231102T221633Z
LAST-MODIFIED:20231102T221716Z
TRANSP:TRANSPARENT
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

Expected behavior
No events should be returned.

Console output
start 2023-10-02 duration 7 days, 0:00:00

Version:

2.1.0

@zoifar zoifar added the bug Something isn't working label Nov 3, 2023
@niccokunzmann
Copy link
Owner

niccokunzmann commented Nov 4, 2023

@zoifar thanks for reporting this. It seems unusual to not remove the event at all. Can you tell me more about the background of where this is generated? The until value often is on a valid repetition date, in this example it is not. I just want to be sure that when this becomes expected behavior that there is a general expectation of ICS functioning like this. Maybe, there is something in the spec... If it is a single person's expectation, it can still be implemented.

I definitely like that you caught a case I would not even have thought about!

@zoifar
Copy link
Author

zoifar commented Nov 4, 2023

@niccokunzmann, this is generated by atlassian confluence calendar when the first event in series and all future instances are deleted.

@niccokunzmann
Copy link
Owner

Thanks, that makes sense to me. Would you like to give it a go?

@niccokunzmann
Copy link
Owner

What happens if you edit a recurrence and then delete the whole event series?

@zoifar
Copy link
Author

zoifar commented Nov 19, 2023

What happens if you edit a recurrence and then delete the whole event series?

If you edit a recurrence and then delete the whole event series, than no events are present in ICS file.

@niccokunzmann
Copy link
Owner

I am not sure if all special cases are covered as there might also be edited recurrences. Either way, you can test with

pip install git+https://github.com/niccokunzmann/python-recurring-ical-events

I think, this issue can be closed and a new version released.
What are your thoughts?

@zoifar
Copy link
Author

zoifar commented Nov 20, 2023

It works. Thank you. This issue can be closed.

@niccokunzmann
Copy link
Owner

This is included in 2.1.1

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