Skip to content

Commit

Permalink
Fixing UTC timezone (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
Olen authored Sep 13, 2021
1 parent fde19a9 commit 943bd71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/ical/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 943bd71

Please sign in to comment.