Fix timezone issue

vobject does not understand Pendulum's custom API for getting the
timezone name. Rather than try to be fancy with timezone-aware schedule
objects, just use UTC and let the calendar software figure out how to
present it in the user's timezone.
This commit is contained in:
Ian Adam Naval 2019-04-01 20:46:27 -04:00
parent 178ffab9a6
commit a5f616436c

View File

@ -10,8 +10,8 @@ VCalendar2_0 = vobject.icalendar.VCalendar2_0
def add_vevent(cal: VCalendar2_0, reservation: Reservation): def add_vevent(cal: VCalendar2_0, reservation: Reservation):
vevent = cal.add('vevent') vevent = cal.add('vevent')
vevent.add('dtstart').value = reservation.start vevent.add('dtstart').value = reservation.start.in_tz('UTC')
vevent.add('dtend').value = reservation.end vevent.add('dtend').value = reservation.end.in_tz('UTC')
vevent.add('summary').value = reservation.summary vevent.add('summary').value = reservation.summary
vevent.add('description').value = reservation.description vevent.add('description').value = reservation.description
return cal return cal