Logbook: Query databse as_utc(). dt: Use pytz's localize (#2521)

This commit is contained in:
Johann Kellerman 2016-07-14 03:45:55 +02:00 committed by Paulus Schoutsen
parent 88b3aa54a8
commit a60a342864
2 changed files with 2 additions and 2 deletions

View File

@ -94,6 +94,7 @@ class LogbookView(HomeAssistantView):
else:
start_day = dt_util.start_of_local_day()
start_day = dt_util.as_utc(start_day)
end_day = start_day + timedelta(days=1)
events = recorder.get_model('Events')

View File

@ -92,8 +92,7 @@ def start_of_local_day(dt_or_d=None):
elif isinstance(dt_or_d, dt.datetime):
dt_or_d = dt_or_d.date()
return dt.datetime.combine(dt_or_d, dt.time()).replace(
tzinfo=DEFAULT_TIME_ZONE)
return DEFAULT_TIME_ZONE.localize(dt.datetime.combine(dt_or_d, dt.time()))
# Copyright (c) Django Software Foundation and individual contributors.