Skip to content

Commit

Permalink
Bug 1801239 - startdate and enddate are 1 day apart (#7714)
Browse files Browse the repository at this point in the history
  • Loading branch information
imgta committed Jun 15, 2023
1 parent fead382 commit 71b14c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion treeherder/webapp/api/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def list(self, request):
if 'enddate' in request.query_params:
enddate = request.query_params['enddate']

if not enddate or not re.match(r'^[0-9]{4}-[0-9]{2}-[0-9]{2}$', enddate):
if (
not enddate
or not re.match(r'^[0-9]{4}-[0-9]{2}-[0-9]{2}$', enddate)
or ((enddate - startdate).days > 1)
):
enddate = startdate + datetime.timedelta(days=1)
else:
enddate = datetime.datetime.strptime(enddate, "%Y-%m-%d")
Expand Down

0 comments on commit 71b14c6

Please sign in to comment.