|
13 | 13 | from django.db import models |
14 | 14 | from django.db.models import QuerySet |
15 | 15 | from django.utils.translation import gettext_lazy as _ |
| 16 | +from django.utils import timezone |
16 | 17 | from rest_framework import serializers |
17 | 18 |
|
18 | 19 | from application.models import ApplicationChatUserStats, Application |
@@ -48,12 +49,14 @@ def is_valid(self, *, raise_exception=False): |
48 | 49 | raise AppApiException(500, _('Application id does not exist')) |
49 | 50 |
|
50 | 51 | def get_end_time(self): |
51 | | - return datetime.datetime.combine( |
52 | | - datetime.datetime.strptime(self.data.get('end_time'), '%Y-%m-%d'), |
53 | | - datetime.datetime.max.time()) |
| 52 | + d = datetime.datetime.strptime(self.data.get('end_time'), '%Y-%m-%d').date() |
| 53 | + naive = datetime.datetime.combine(d, datetime.time.max) |
| 54 | + return timezone.make_aware(naive, timezone.get_default_timezone()) |
54 | 55 |
|
55 | 56 | def get_start_time(self): |
56 | | - return self.data.get('start_time') |
| 57 | + d = datetime.datetime.strptime(self.data.get('start_time'), '%Y-%m-%d').date() |
| 58 | + naive = datetime.datetime.combine(d, datetime.time.min) |
| 59 | + return timezone.make_aware(naive, timezone.get_default_timezone()) |
57 | 60 |
|
58 | 61 | def get_customer_count_trend(self, with_valid=True): |
59 | 62 | if with_valid: |
|
0 commit comments