Skip to content

Commit

Permalink
fix multiple EXDATE rows
Browse files Browse the repository at this point in the history
  • Loading branch information
janusfil committed Jul 19, 2024
1 parent 2b3dfb4 commit 8d43b63
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions calcure/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,12 @@ def __init__(self, user_events, use_persian_calendar, until_year, until_month):
rset.rrule(rule)

if event.exdate:
for exdate in event.exdate.dts:
exdate_dt = datetime.datetime.combine(exdate.dt, datetime.time.min, tzinfo=dtstart.tzinfo) if not isinstance(exdate.dt, datetime.datetime) else exdate.dt
rset.exdate(exdate_dt)
exdates_list = [event.exdate] if not isinstance(event.exdate, list) else event.exdate

for exdates in exdates_list:
for exdate in exdates.dts:
exdate_dt = datetime.datetime.combine(exdate.dt, datetime.time.min, tzinfo=dtstart.tzinfo) if not isinstance(exdate.dt, datetime.datetime) else exdate.dt
rset.exdate(exdate_dt)

for date in list(rset)[1:]:
self.add_item(UserRepeatedEvent(event.item_id, date.year, date.month, date.day, event.name,
Expand Down

0 comments on commit 8d43b63

Please sign in to comment.