You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following sample code to generate a simple event that spans 2 timezones (AST to EST) seems to create an invalid .ics file. The file cannot be read correctly by the macOS Calendar app, which treats it as a calendar rather than an individual event and will not import the event regardless.
It's also possible that it's an Apple bug, rather than vobject, but I don't understand the VCalendar format well enough to know where the issue is. My guess is it for some reason thinks the end time is before the start time due to the timezone difference, but that isn't true; these timezones are only 1 hour apart for this date, and I even used an assert to confirm that the end time is greater than the start time. Still, if I make the times further apart, it works correctly.
Any idea what's going on here?
macOS Big Sur 11.6.1
Calendar 11.0
Python 3.9.9
vobject 0.9.6.1
from datetime import datetime
from dateutil import zoneinfo
import vobject
if __name__ == '__main__':
start = datetime(2021, 12, 1, 15, 30, tzinfo=zoneinfo.gettz('America/St_Thomas'))
end = datetime(2021, 12, 1, 18, 30, tzinfo=zoneinfo.gettz('America/New_York'))
assert end > start
cal = vobject.iCalendar()
event = cal.add('vevent')
event.add('summary').value = 'Test Event'
event.add('dtstart').value = start
event.add('dtend').value = end
with open('test.ics', 'w') as f:
cal.serialize(f)
The text was updated successfully, but these errors were encountered:
The following sample code to generate a simple event that spans 2 timezones (AST to EST) seems to create an invalid .ics file. The file cannot be read correctly by the macOS Calendar app, which treats it as a calendar rather than an individual event and will not import the event regardless.
It's also possible that it's an Apple bug, rather than vobject, but I don't understand the VCalendar format well enough to know where the issue is. My guess is it for some reason thinks the end time is before the start time due to the timezone difference, but that isn't true; these timezones are only 1 hour apart for this date, and I even used an assert to confirm that the end time is greater than the start time. Still, if I make the times further apart, it works correctly.
Any idea what's going on here?
macOS Big Sur 11.6.1
Calendar 11.0
Python 3.9.9
vobject 0.9.6.1
The text was updated successfully, but these errors were encountered: