skarim / vobject

A full-featured Python package for parsing and creating iCalendar and vCard files
https://vobject.sameenkarim.com
255 stars 93 forks source link

How to deal with rrule?? #148

Open tamis-laan opened 5 years ago

tamis-laan commented 5 years ago

I'm trying to work with event.rrule, I'm using the following dateutile.rrule function to get the dates:

dates = dateutil.rrule.rrulestr(event.rrule.value,dtstart=event.dtstart.value)

However I get the following error:

ValueError: RRULE UNTIL values must be specified in UTC when DTSTART is timezone-aware

I have the following for: rrule.value: FREQ=YEARLY;WKST=MO;UNTIL=20190328T235959Z dtstart.value: 2018-09-23

As you can see the rrule until date is timezoned while the dtstart is naive time. I also get the opposite of this where until can be naive and dtstart timezoned. So I need to convert one of there values to the appropriate timezone.

How can I do this? How can I obtain the UNTIL date?

psociety commented 4 years ago

Maybe this helps you:

result = component.getrruleset(addRDate=True)

if you then do

print(result[1], result[2])

It returns dates that follow those rules.

This is all docu i found: http://vobject.skyhouseconsulting.com/epydoc/

What i'm not able to do is to simply know if a given day meets that rrule or not (so i can easily know if the event happens today.).