Change get_datetime to handle year changes.
build

This commit is contained in:
2023-07-02 10:18:53 -04:00
parent 9f3b625cd2
commit 1044f8a521
+10 -2
View File
@@ -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)