collective / icalendar

icalendar parser library for Python

Home Page:https://icalendar.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Incorrect handling of complex recurring events (e.g., in calendars imported from Google Calendar)

wzab opened this issue · comments

Describe the bug

I needed to import a heavily edited Google Calendar for further processing in Python on a local machine.
Certain events were initially created as instances of a recurring event, but then they were shifted or otherwise modifed.
As the result, the "ics" file exported by the Google Calendar could not be correctly interpreted by icalendar library.
The start date of the first event in the cycle (even though excluded) was displayed as the start date of the particular event.
The "ics" file itself is correct. After importing it to Thunderbird, the correct set of events is shown. Also the ical2htnl tool based on the old libical library generates the correct calendar. I attach an archive with the ics file exposing the problem and with the correct output generated by ical2html.

To Reproduce

Run the icalendar tool on the provided file:

icalendar linsw.ics

Find the "L5B G3" event in the output:

    Summary    : L5B G3 LINSW
    Starts     : Fri Mar  8 11:15:00 2024
    End        : Fri Mar  8 14:00:00 2024
    Duration   : 2:45:00
    Location   : Somewhere, Certain city
    Comment    : 
    Description:
     

    Organizer: 
    Attendees:

Run the ical2html file using the old libical library:

ical2html 20240201 P21W linsw.ics > linsw.html

You should get the HTML file with table, where "L5B G3" event is correctly scheduled on June 14.

Environment

  • OS: Debian/testing
  • Python version: Python 3.11.7
  • icalendar version: 5.0.11

Additional context

  • [ no ] I tested it with the latest version pip3 install https://github.com/collective/icalendar.git
  • [ yes ] I attached the ICS source file or there is no ICS source file

I couldnt test it with the latest version. An attempt to install it in a virtual environment resulted in another error:

pip3 install https://github.com/collective/icalendar.git
Collecting https://github.com/collective/icalendar.git
  Downloading https://github.com/collective/icalendar.git
     / 296.2 kB 1.4 MB/s 0:00:00
  ERROR: Cannot unpack file /tmp/pip-unpack-4rqg8rs3/icalendar.git (downloaded from /tmp/pip-req-build-rt7rmbmr, content-type: text/html; charset=utf-8); cannot detect archive format
ERROR: Cannot determine archive format of /tmp/pip-req-build-rt7rmbmr

demo.zip