diff --git a/utils.py b/utils.py index 7a2fc75..b0f0d92 100644 --- a/utils.py +++ b/utils.py @@ -1,3 +1,7 @@ +""" +File contains util functions. +""" + from datetime import datetime @@ -11,8 +15,12 @@ def get_datetime(day: str) -> datetime: Returns: datetime: Datetime representation of Month/Day. """ - today = datetime.today() + year = datetime.today().year month = int(day.split("/")[0]) day = int(day.split("/")[1]) - return datetime(today.year, month, day) + # ensure that year rolls over if current month is December and the next month is less than 12. + if datetime.today().month == 12 & month < 12: + year += 1 + + return datetime(year, month, day)