Fix GTFS sensor wrong timezone (#26580)

This commit is contained in:
Tsvi Mostovicz 2019-09-11 19:00:18 +03:00 committed by Martin Hjelmare
parent f53fcacf49
commit 7dfdec531c

View File

@ -122,7 +122,7 @@ def get_next_departure(
include_tomorrow: bool = False, include_tomorrow: bool = False,
) -> dict: ) -> dict:
"""Get the next departure for the given schedule.""" """Get the next departure for the given schedule."""
now = datetime.datetime.now() + offset now = dt_util.now().replace(tzinfo=None) + offset
now_date = now.strftime(dt_util.DATE_STR_FORMAT) now_date = now.strftime(dt_util.DATE_STR_FORMAT)
yesterday = now - datetime.timedelta(days=1) yesterday = now - datetime.timedelta(days=1)
yesterday_date = yesterday.strftime(dt_util.DATE_STR_FORMAT) yesterday_date = yesterday.strftime(dt_util.DATE_STR_FORMAT)