Skip to content

Commit

Permalink
Issue Yelp#145: Make calendar link timezone aware
Browse files Browse the repository at this point in the history
  • Loading branch information
conancain committed May 12, 2022
1 parent c1d5fef commit a60d077
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/yelp_beans/send_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ def create_google_calendar_invitation_link(user_list, title, office, location, m
'location': office + " " + location,
'add': ','.join([user.email for user in user_list])
}
try:
if meeting_datetime.strftime("%Z") and "ctz" not in url_params:
# If the meeting time have a timezone specified
# and Calendar URL link doesn't contain timezone
# Add the "ctz" parameter to Google's Calendar template link
url_params["ctz"] = meeting_datetime.tzinfo.zone
except Exception:
logging.exception("Failed to add timezone information to Google Calendar link")
invite_url += urllib.parse.urlencode(url_params)
return invite_url

Expand Down

0 comments on commit a60d077

Please sign in to comment.