mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Logbook: Query databse as_utc(). dt: Use pytz's localize (#2521)
This commit is contained in:
parent
88b3aa54a8
commit
a60a342864
@ -94,6 +94,7 @@ class LogbookView(HomeAssistantView):
|
|||||||
else:
|
else:
|
||||||
start_day = dt_util.start_of_local_day()
|
start_day = dt_util.start_of_local_day()
|
||||||
|
|
||||||
|
start_day = dt_util.as_utc(start_day)
|
||||||
end_day = start_day + timedelta(days=1)
|
end_day = start_day + timedelta(days=1)
|
||||||
|
|
||||||
events = recorder.get_model('Events')
|
events = recorder.get_model('Events')
|
||||||
|
@ -92,8 +92,7 @@ def start_of_local_day(dt_or_d=None):
|
|||||||
elif isinstance(dt_or_d, dt.datetime):
|
elif isinstance(dt_or_d, dt.datetime):
|
||||||
dt_or_d = dt_or_d.date()
|
dt_or_d = dt_or_d.date()
|
||||||
|
|
||||||
return dt.datetime.combine(dt_or_d, dt.time()).replace(
|
return DEFAULT_TIME_ZONE.localize(dt.datetime.combine(dt_or_d, dt.time()))
|
||||||
tzinfo=DEFAULT_TIME_ZONE)
|
|
||||||
|
|
||||||
|
|
||||||
# Copyright (c) Django Software Foundation and individual contributors.
|
# Copyright (c) Django Software Foundation and individual contributors.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user