

Note: The parsing to rrule needs to be improved.

To do that you need a 3rd party too called 'Dates to iCal 2'. But I don't think it will let you show your new 'Anniversaries' field as its own calendar. What happens then is a so called 'time-out' which means new dates don´t get uploaded anymore. iCal by default will allow you to show 'Birthdays' as a calendar. Parsed end: 11:00:00-04:00 at TZ America/New_York To have these show up automatically in iCal is a bit trickier. Output: parsed start: 09:00:00-04:00 at TZ America/New_York I also adjusted the test-data (ical entry with 2 reference timestamps). helper function to show events generated from rrule: event_list().evaluate if there is an event for this rrule which contains the reference/target time-stamp: datetime_in_rrule().parse the ical entry to rrule and delta returned as tuple: ical_to_rrule_delta().

I would split your task/problem into 3 parts: Res = rules.between(target_time - event_delta, target_time + timedelta(minutes=1)) Recurring_rule = irrule.to_ical().decode('utf-8')įirst_rule = rrule.rrulestr(recurring_rule, dtstart=start_time_dt)Įvent_delta = end_time_dt - start_time_dt if end_time_dt else timedelta(days=1) Start_time_dt = start_time_dt.replace(tzinfo=None).replace(tzinfo=tzinfo)Įnd_time_dt = ical.dt if ical.get("DTEND") else None Tzinfo = gettz(str(start_time_dt.tzinfo)) How can I confirm that the datetime object falls within the ical string? I've tried using rules.between but this datetime, which should overlap with the ical string, does not.įrom datetime import datetime, timedelta, timezone RRULE:FREQ=WEEKLY BYDAY=SU,MO,TU,WE,TH,FR,SAĪnd a datetime object datetime(2022, 11, 7, 4, 53, tzinfo=timezone.utc).
