diff --git a/aocp/aoc.py b/aocp/aoc.py index de6099629aa8026050ff214c0c11bc01e57d7616..02244708b3d062147155271e71ccaa55ccb1dd0d 100755 --- a/aocp/aoc.py +++ b/aocp/aoc.py @@ -135,16 +135,18 @@ def init_app(app): """ app.cli.add_command(test_aoc_py_command) -def get_aoc_day(timestamp : datetime = datetime.now(tz=timezone.utc), year : int|None = None)-> Tuple[int, int]: +def get_aoc_day(timestamp : datetime|None = None, year : int|None = None)-> Tuple[int, int]: """ Returns a tuple: - The current AOC Day (1-25), or 0 if the event hasn't started yet, or 26 if the event is already over. - The hour (0-23) of the AOC Day of the timestamp. Parameters: - timestamp -- Overwrite the "current" timestamp. Must be timezone aware. + timestamp -- Overwrite the "current" timestamp. Must be timezone aware. If timestamp is None, the current time is used. year -- Overwrite the AOC year. If None the YEAR from the config is used. """ + if timestamp is None: + timestamp = datetime.now(tz=timezone.utc) timestamp = timestamp.astimezone(ZoneInfo("EST")) # convert to EST time hour = timestamp.hour if year is None: