Skip to content

Commit

Permalink
make date timezone aware
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkywafer committed Jan 4, 2022
1 parent 312b8ba commit 8e9cbe2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/anniversaries/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Sensor """
from dateutil import tz
from dateutil.relativedelta import relativedelta
from datetime import datetime, date

Expand Down Expand Up @@ -73,6 +74,7 @@ def __init__(self, hass, config):
self._template_sensor = True
else:
self._date, self._unknown_year = validate_date(config.get(CONF_DATE))
self._date = self._date.replace(tzinfo=tz.tzlocal())
if self._show_half_anniversary:
self._half_date = self._date + relativedelta(months=+6)
self._icon_normal = config.get(CONF_ICON_NORMAL)
Expand Down

0 comments on commit 8e9cbe2

Please sign in to comment.