parent
7a50ea6016
commit
61e17d9c96
10 changed files with 416 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ import flask
|
|||
|
||||
import agenda.uk_holiday
|
||||
import holidays
|
||||
from agenda.uk_school_holiday import school_holiday_list
|
||||
|
||||
from .event import Event
|
||||
from .types import Holiday, Trip
|
||||
|
|
@ -29,6 +30,23 @@ def get_trip_holidays(trip: Trip) -> list[Holiday]:
|
|||
)
|
||||
|
||||
|
||||
def get_school_holidays(start_date: date, end_date: date, data_dir: str) -> list[Event]:
|
||||
"""Get UK school holidays from cache."""
|
||||
return school_holiday_list(start_date, end_date, data_dir)
|
||||
|
||||
|
||||
def get_trip_school_holidays(trip: Trip) -> list[Event]:
|
||||
"""Get UK school holidays happening during trip."""
|
||||
if not trip.end:
|
||||
return []
|
||||
|
||||
return get_school_holidays(
|
||||
trip.start,
|
||||
trip.end,
|
||||
flask.current_app.config["DATA_DIR"],
|
||||
)
|
||||
|
||||
|
||||
def us_holidays(start_date: date, end_date: date) -> list[Holiday]:
|
||||
"""Get US holidays."""
|
||||
found: list[Holiday] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue