Skip to content
Snippets Groups Projects
Commit a0e9ddcf authored by bmedx's avatar bmedx
Browse files

Fix timezone issues in retirements_by_status_and_date

parent e5521d9e
No related merge requests found
......@@ -695,9 +695,9 @@ class AccountRetirementStatusView(ViewSet):
so to get one day you would set both dates to that day.
"""
try:
start_date = datetime.datetime.strptime(request.GET['start_date'], '%Y-%m-%d')
end_date = datetime.datetime.strptime(request.GET['end_date'], '%Y-%m-%d')
now = datetime.datetime.now()
start_date = datetime.datetime.strptime(request.GET['start_date'], '%Y-%m-%d').replace(tzinfo=pytz.UTC)
end_date = datetime.datetime.strptime(request.GET['end_date'], '%Y-%m-%d').replace(tzinfo=pytz.UTC)
now = datetime.datetime.now(pytz.UTC)
if start_date > now or end_date > now or start_date > end_date:
raise RetirementStateError('Dates must be today or earlier, and start must be earlier than end.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment