Verified Commit f7b66943 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Fix start/end date parsing in events API

parent 7145b74b
......@@ -71,6 +71,7 @@ def extract_date_range(request, allow_empty=False):
default_value = None
start = request.query_params.get('start', default_value)
if start:
start = dateparse.parse_datetime(start)
if not timezone.is_aware(start):
start = timezone.make_aware(start)
......@@ -78,8 +79,9 @@ def extract_date_range(request, allow_empty=False):
if not start and not allow_empty:
raise ParseError(detail='start query parameter invalid')
end = dateparse.parse_datetime(
request.query_params.get('end', default_value))
end = request.query_params.get('end', default_value)
if end:
end = dateparse.parse_datetime(end)
if not timezone.is_aware(end):
end = timezone.make_aware(end)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment