Fix rova timezone (#61302)

This commit is contained in:
Paulus Schoutsen 2021-12-08 22:36:41 -08:00 committed by GitHub
parent 4933189ad9
commit 8f238d6b53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ from homeassistant.const import (
)
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
from homeassistant.util.dt import get_time_zone, now
# Config for rova requests.
CONF_ZIP_CODE = "zip_code"
@ -140,10 +141,12 @@ class RovaData:
self.data = {}
for item in items:
date = datetime.strptime(item["Date"], "%Y-%m-%dT%H:%M:%S")
date = datetime.strptime(item["Date"], "%Y-%m-%dT%H:%M:%S").replace(
tzinfo=get_time_zone("Europe/Amsterdam")
)
code = item["GarbageTypeCode"].lower()
if code not in self.data and date > datetime.now():
if code not in self.data and date > now():
self.data[code] = date
_LOGGER.debug("Updated Rova calendar: %s", self.data)