mirror of
https://github.com/home-assistant/core.git
synced 2026-08-03 20:24:55 +02:00
Fix possible timezone issue in Trafikverket Train (#170595)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: joostlek <7083755+joostlek@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from datetime import date, timedelta
|
||||
|
||||
from homeassistant.const import WEEKDAYS
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
||||
def next_weekday(fromdate: date, weekday: int) -> date:
|
||||
@@ -15,7 +16,7 @@ def next_weekday(fromdate: date, weekday: int) -> date:
|
||||
|
||||
def next_departuredate(departure: list[str]) -> date:
|
||||
"""Calculate the next departuredate from an array input of short days."""
|
||||
today_date = date.today() # noqa: DTZ011
|
||||
today_date = dt_util.now().date()
|
||||
today_weekday = date.weekday(today_date)
|
||||
if WEEKDAYS[today_weekday] in departure:
|
||||
return today_date
|
||||
|
||||
Reference in New Issue
Block a user