From bf51c8cd9dbb44d8a079e24fca4a6d1fc65d39d1 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Fri, 8 Sep 2017 10:32:12 +0200 Subject: [PATCH] midnight is timezone aware --- smash/web/views/notifications.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index 0d47a354..6a580bc5 100644 --- a/smash/web/views/notifications.py +++ b/smash/web/views/notifications.py @@ -1,5 +1,6 @@ # coding=utf-8 import datetime +from django.utils import timezone from django.contrib.auth.models import User, AnonymousUser from django.db.models import Count, Case, When @@ -239,6 +240,6 @@ def get_filter_locations(user): def get_today_midnight_date(): - today = datetime.datetime.now() - today_midnight = datetime.datetime(today.year, today.month, today.day) + today = timezone.now() + today_midnight = datetime.datetime(today.year, today.month, today.day, tzinfo=today.tzinfo) return today_midnight -- GitLab