From 943bd713f1dd153097c94a780b9b46681729a624 Mon Sep 17 00:00:00 2001 From: Olen Date: Mon, 13 Sep 2021 17:09:06 +0200 Subject: [PATCH] Fixing UTC timezone (#43) --- custom_components/ical/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/ical/__init__.py b/custom_components/ical/__init__.py index 88f38d3..ad1ef53 100644 --- a/custom_components/ical/__init__.py +++ b/custom_components/ical/__init__.py @@ -5,7 +5,7 @@ import logging from dateutil.rrule import rruleset, rrulestr -from dateutil.tz import gettz +from dateutil.tz import gettz, tzutc import icalendar import voluptuous as vol @@ -393,6 +393,8 @@ def _ical_date_fixer(self, indate, timezone="UTC"): if not str(indate.tzinfo).startswith("tzfile"): # _LOGGER.debug("Pytz indate: %s. replacing with tz %s", str(indate), str(gettz(str(indate.tzinfo)))) indate = indate.replace(tzinfo=gettz(str(indate.tzinfo))) + if str(indate.tzinfo).endswith('/UTC'): + indate = indate.replace(tzinfo=tzutc) # _LOGGER.debug("Tzinfo 2: %s", str(indate.tzinfo)) _LOGGER.debug("Out date: %s", str(indate))