1 """Utils for trafikverket_train."""
3 from __future__
import annotations
5 from datetime
import date, timedelta
11 """Return the date of the next time a specific weekday happen."""
12 days_ahead = weekday - fromdate.weekday()
19 """Calculate the next departuredate from an array input of short days."""
20 today_date = date.today()
21 today_weekday = date.weekday(today_date)
22 if WEEKDAYS[today_weekday]
in departure:
25 next_departure = WEEKDAYS.index(day)
26 if next_departure > today_weekday:
28 return next_weekday(today_date, WEEKDAYS.index(departure[0]))
date next_weekday(date fromdate, int weekday)
date next_departuredate(list[str] departure)