updates ical output to convert event times to calendar timzone based time
This commit is contained in:
parent
056779f7d2
commit
f939127a0c
@ -27,7 +27,7 @@ def fetchCalendarEvents(calendars, startDate, endDate):
|
|||||||
if calendar.toggle == "True" and calendar.calendar_type == "ical":
|
if calendar.toggle == "True" and calendar.calendar_type == "ical":
|
||||||
ical = iCalendar(requests.get(calendar.calendar_id).text)
|
ical = iCalendar(requests.get(calendar.calendar_id).text)
|
||||||
for event in ical.events:
|
for event in ical.events:
|
||||||
|
event = fitEventToCalendarTimezone(event, ical)
|
||||||
name = event.name
|
name = event.name
|
||||||
start = event.begin.format()
|
start = event.begin.format()
|
||||||
end = event.end.format()
|
end = event.end.format()
|
||||||
@ -38,10 +38,15 @@ def fetchCalendarEvents(calendars, startDate, endDate):
|
|||||||
if eventWithinStartEnd(startDate, endDate, event):
|
if eventWithinStartEnd(startDate, endDate, event):
|
||||||
if not eventAllDay(event):
|
if not eventAllDay(event):
|
||||||
|
|
||||||
|
print(start, flush=True)
|
||||||
all_events.append(newEvent)
|
all_events.append(newEvent)
|
||||||
|
|
||||||
return all_events
|
return all_events
|
||||||
|
|
||||||
|
def fitEventToCalendarTimezone(event, calendar):
|
||||||
|
event.begin = event.begin.to(next(iter(calendar._timezones)))
|
||||||
|
event.end = event.end.to(next(iter(calendar._timezones)))
|
||||||
|
return event
|
||||||
|
|
||||||
# converts everything to epoch seconds and utc
|
# converts everything to epoch seconds and utc
|
||||||
# and then checks if at either event start or event end
|
# and then checks if at either event start or event end
|
||||||
|
Loading…
Reference in New Issue
Block a user