Fix time range selection
This commit is contained in:
parent
1264a305da
commit
ce16fd4b36
@ -1,5 +1,6 @@
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
from datetime import time, datetime
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
@ -9,8 +10,7 @@ class DateRangeMixin:
|
|||||||
found_time = timezone.datetime.strptime(
|
found_time = timezone.datetime.strptime(
|
||||||
self.request.GET.get("startDate"), "%Y-%m-%d"
|
self.request.GET.get("startDate"), "%Y-%m-%d"
|
||||||
)
|
)
|
||||||
found_time.replace(hour=0, minute=0)
|
return timezone.make_aware(datetime.combine(found_time, time.min))
|
||||||
return found_time
|
|
||||||
else:
|
else:
|
||||||
return timezone.now() - timezone.timedelta(days=30)
|
return timezone.now() - timezone.timedelta(days=30)
|
||||||
|
|
||||||
@ -19,8 +19,7 @@ class DateRangeMixin:
|
|||||||
found_time = timezone.datetime.strptime(
|
found_time = timezone.datetime.strptime(
|
||||||
self.request.GET.get("endDate"), "%Y-%m-%d"
|
self.request.GET.get("endDate"), "%Y-%m-%d"
|
||||||
)
|
)
|
||||||
found_time.replace(hour=23, minute=59)
|
return timezone.make_aware(datetime.combine(found_time, time.max))
|
||||||
return found_time
|
|
||||||
else:
|
else:
|
||||||
return timezone.now()
|
return timezone.now()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user