diff --git a/agenda/conference.py b/agenda/conference.py index 9960f80..36f6e06 100644 --- a/agenda/conference.py +++ b/agenda/conference.py @@ -6,8 +6,11 @@ from datetime import date, datetime import yaml +from . import utils from .event import Event +MAX_CONF_DAYS = 20 + @dataclasses.dataclass class Conference: @@ -55,6 +58,9 @@ def get_list(filepath: str) -> list[Event]: """Read conferences from a YAML file and return a list of Event objects.""" events: list[Event] = [] for conf in (Conference(**conf) for conf in yaml.safe_load(open(filepath, "r"))): + assert conf.start <= conf.end + duration = (utils.as_date(conf.end) - utils.as_date(conf.start)).days + assert duration < MAX_CONF_DAYS event = Event( name="conference", date=conf.start,