Skip to content

Time

AOC_TIMEZONE_NAME = 'EST' module-attribute

The Advent of Code timezone name.

AOC_TIMEZONE = timezone(AOC_TIMEZONE_NAME) module-attribute

The Advent of Code timezone.

aoc_today() -> Date

Returns the current date in the AOC_TIMEZONE.

Source code in aoc/time.py
14
15
16
def aoc_today() -> Date:
    """Returns the current date in the [`AOC_TIMEZONE`][aoc.time.AOC_TIMEZONE]."""
    return today(AOC_TIMEZONE)

get_key_for_date(date: Date) -> Key

Returns the key for the given date.

Raises:

Type Description
ValueError

The date does not represent the Advent of Code day.

Source code in aoc/time.py
19
20
21
22
23
24
25
def get_key_for_date(date: Date) -> Key:
    """Returns the key for the given `date`.

    Raises:
        ValueError: The `date` does not represent the Advent of Code day.
    """
    return Key(Year(date.year), Day(date.day))