From 06edb22651024bef45c3b7630ae85a422d8cb710 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 30 Jan 2017 08:55:25 -0800 Subject: [PATCH] Fix dates on history and logbook --- panels/history/ha-panel-history.html | 10 +++------- panels/logbook/ha-panel-logbook.html | 10 +++------- src/data/ha-state-history-data.html | 2 -- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index b68c54c5d5..ae0c46db91 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -86,7 +86,9 @@ Polymer({ _selectedDate: { type: Date, value: function () { - return new Date(); + var begin = new Date(); + begin.setHours(0, 0, 0, 0); + return begin; }, }, @@ -107,12 +109,6 @@ Polymer({ field: document.createElement('input'), trigger: this.$.datePicker.inputElement, onSelect: function (newDate) { - newDate.setDate(newDate.getDate() + 1); - - if (newDate > new Date()) { - newDate = new Date(); - } - this._selectedDate = newDate; }.bind(this), }); diff --git a/panels/logbook/ha-panel-logbook.html b/panels/logbook/ha-panel-logbook.html index c67f6447f2..314936e1f7 100644 --- a/panels/logbook/ha-panel-logbook.html +++ b/panels/logbook/ha-panel-logbook.html @@ -89,7 +89,9 @@ Polymer({ _selectedDate: { type: String, value: function () { - return new Date(); + var begin = new Date(); + begin.setHours(0, 0, 0, 0); + return begin; }, }, @@ -117,12 +119,6 @@ Polymer({ field: document.createElement('input'), trigger: this.$.datePicker.inputElement, onSelect: function (newDate) { - newDate.setDate(newDate.getDate() + 1); - - if (newDate > new Date()) { - newDate = new Date(); - } - this._selectedDate = newDate; }.bind(this), }); diff --git a/src/data/ha-state-history-data.html b/src/data/ha-state-history-data.html index 8cc770435b..501e1cfae2 100644 --- a/src/data/ha-state-history-data.html +++ b/src/data/ha-state-history-data.html @@ -38,8 +38,6 @@ } }); - timelineDevices = timelineDevices.length > 0 && timelineDevices; - unitStates = Object.keys(lineChartDevices).map( function (unit) { return { unit: unit, data: lineChartDevices[unit] };