Skip to content

Commit 6e29dd6

Browse files
zkoppertCopilot
andauthored
Update env.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Zack Koppert <zkoppert@github.com>
1 parent fa5d5f6 commit 6e29dd6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

env.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,16 @@ def validate_date_range(start_date: str, end_date: str) -> None:
8585
if not start_date or not end_date:
8686
return
8787

88-
# YYYY-MM-DD format allows direct string comparison
89-
if end_date <= start_date:
88+
pattern = "%Y-%m-%d"
89+
try:
90+
start = datetime.datetime.strptime(start_date, pattern).date()
91+
end = datetime.datetime.strptime(end_date, pattern).date()
92+
except ValueError as exc:
93+
raise ValueError(
94+
"start_date and end_date must be in the format YYYY-MM-DD"
95+
) from exc
96+
97+
if end <= start:
9098
raise ValueError(
9199
f"END_DATE ('{end_date}') must be after START_DATE ('{start_date}')"
92100
)

0 commit comments

Comments
 (0)