fix: google calendar sync times (system tz) (#18458)
* fix: google calendar sync times (system tz) * added line breaks to excessively long bit * (chore) linter appeasement * chore: linting [skip ci]
This commit is contained in:
parent
d0715dd574
commit
3676188083
1 changed files with 15 additions and 6 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
from urllib.parse import quote
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import google.oauth2.credentials
|
||||
import requests
|
||||
|
|
@ -566,12 +567,20 @@ def google_calendar_to_repeat_on(start, end, recurrence=None):
|
|||
Both have been mapped in a dict for easier mapping.
|
||||
"""
|
||||
repeat_on = {
|
||||
"starts_on": get_datetime(start.get("date"))
|
||||
if start.get("date")
|
||||
else parser.parse(start.get("dateTime")).astimezone().replace(tzinfo=None),
|
||||
"ends_on": get_datetime(end.get("date"))
|
||||
if end.get("date")
|
||||
else parser.parse(end.get("dateTime")).astimezone().replace(tzinfo=None),
|
||||
"starts_on": (
|
||||
get_datetime(start.get("date"))
|
||||
if start.get("date")
|
||||
else parser.parse(start.get("dateTime"))
|
||||
.astimezone(ZoneInfo(get_time_zone()))
|
||||
.replace(tzinfo=None)
|
||||
),
|
||||
"ends_on": (
|
||||
get_datetime(end.get("date"))
|
||||
if end.get("date")
|
||||
else parser.parse(end.get("dateTime"))
|
||||
.astimezone(ZoneInfo(get_time_zone()))
|
||||
.replace(tzinfo=None)
|
||||
),
|
||||
"all_day": 1 if start.get("date") else 0,
|
||||
"repeat_this_event": 1 if recurrence else 0,
|
||||
"repeat_on": None,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue