From eb7dc87971eab0ea796141ac2df37182fccc7231 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Sun, 17 Jul 2016 20:58:32 -0400 Subject: [PATCH 1/8] Use local timezone for log and history dates --- home-assistant-js | 2 +- panels/history/ha-panel-history.html | 16 +++++++++++++++- panels/logbook/ha-panel-logbook.html | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/home-assistant-js b/home-assistant-js index b7ac88af0b..3f29d9a833 160000 --- a/home-assistant-js +++ b/home-assistant-js @@ -1 +1 @@ -Subproject commit b7ac88af0bf5a6065c021e47dc6af0f7006b187b +Subproject commit 3f29d9a833a4aeeda350119bffa778fe944faace diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index 03879ffce3..a31ae46d33 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -36,7 +36,7 @@
+ value='[[selectedDateStr]]'> @@ -94,6 +94,20 @@ Polymer({ return hass.entityHistoryGetters.currentDate; }, }, + + selectedDateStr: { + type: String, + value: null, + bindNuclear: function (hass) { + return [ + hass.entityHistoryGetters.currentDate, + function (currentDate) { + var dateObj = new Date(currentDate); + return dateObj.toLocaleDateString(); + }, + ]; + }, + }, }, isDataLoadedChanged: function (newVal) { diff --git a/panels/logbook/ha-panel-logbook.html b/panels/logbook/ha-panel-logbook.html index d35feb5651..915a0c2410 100644 --- a/panels/logbook/ha-panel-logbook.html +++ b/panels/logbook/ha-panel-logbook.html @@ -37,7 +37,7 @@ @@ -77,6 +77,20 @@ Polymer({ }, }, + selectedDateStr: { + type: String, + value: null, + bindNuclear: function (hass) { + return [ + hass.logbookGetters.currentDate, + function (currentDate) { + var dateObj = new Date(currentDate); + return dateObj.toLocaleDateString(); + }, + ]; + }, + }, + isLoading: { type: Boolean, bindNuclear: function (hass) { From 911159e33f3d3ea3fe4e0bd854db288f52188058 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 25 Jul 2016 15:21:27 -0400 Subject: [PATCH 2/8] home-assistant-js fix --- home-assistant-js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-assistant-js b/home-assistant-js index 3f29d9a833..6ba80f7bb8 160000 --- a/home-assistant-js +++ b/home-assistant-js @@ -1 +1 @@ -Subproject commit 3f29d9a833a4aeeda350119bffa778fe944faace +Subproject commit 6ba80f7bb82a27457bedc63da2b350f87fcd2530 From e006ad983552a759f336ef3e73ff90b2df89c0f6 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 25 Jul 2016 18:19:40 -0400 Subject: [PATCH 3/8] Submodule updates not included so travis can build --- home-assistant-js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-assistant-js b/home-assistant-js index 6ba80f7bb8..b7ac88af0b 160000 --- a/home-assistant-js +++ b/home-assistant-js @@ -1 +1 @@ -Subproject commit 6ba80f7bb82a27457bedc63da2b350f87fcd2530 +Subproject commit b7ac88af0bf5a6065c021e47dc6af0f7006b187b From 1203312ac33d32860807a734171e2452bb4a196e Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 25 Jul 2016 18:31:20 -0400 Subject: [PATCH 4/8] Fix indentation --- panels/history/ha-panel-history.html | 10 +++++----- panels/logbook/ha-panel-logbook.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index a31ae46d33..51239a25db 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -100,11 +100,11 @@ Polymer({ value: null, bindNuclear: function (hass) { return [ - hass.entityHistoryGetters.currentDate, - function (currentDate) { - var dateObj = new Date(currentDate); - return dateObj.toLocaleDateString(); - }, + hass.entityHistoryGetters.currentDate, + function (currentDate) { + var dateObj = new Date(currentDate); + return dateObj.toLocaleDateString(); + }, ]; }, }, diff --git a/panels/logbook/ha-panel-logbook.html b/panels/logbook/ha-panel-logbook.html index 915a0c2410..fb246d8282 100644 --- a/panels/logbook/ha-panel-logbook.html +++ b/panels/logbook/ha-panel-logbook.html @@ -82,11 +82,11 @@ Polymer({ value: null, bindNuclear: function (hass) { return [ - hass.logbookGetters.currentDate, - function (currentDate) { - var dateObj = new Date(currentDate); - return dateObj.toLocaleDateString(); - }, + hass.logbookGetters.currentDate, + function (currentDate) { + var dateObj = new Date(currentDate); + return dateObj.toLocaleDateString(); + }, ]; }, }, From 0a0a24e5ebee04324ccd7664c13e25cd0d6d6823 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Tue, 26 Jul 2016 13:57:56 -0400 Subject: [PATCH 5/8] History and Logbook panel fixes --- panels/history/ha-panel-history.html | 13 ++++++++++--- panels/logbook/ha-panel-logbook.html | 5 ++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index 51239a25db..00ac7e1264 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -35,8 +35,12 @@ on-tap="handleRefreshClick">
- + @@ -128,9 +132,12 @@ Polymer({ attached: function () { this.datePicker = new window.Pikaday({ - field: this.$.datePicker.inputElement, + field: document.createElement("input"), + trigger: this.$.datePicker.inputElement, onSelect: this.hass.entityHistoryActions.changeCurrentDate, }); + // Set the initial datePicker date, without triggering onSelect handler. + this.datePicker.setDate(this.selectedDate, true); }, detached: function () { diff --git a/panels/logbook/ha-panel-logbook.html b/panels/logbook/ha-panel-logbook.html index fb246d8282..bc61fc4662 100644 --- a/panels/logbook/ha-panel-logbook.html +++ b/panels/logbook/ha-panel-logbook.html @@ -139,9 +139,12 @@ Polymer({ attached: function () { this.datePicker = new window.Pikaday({ - field: this.$.datePicker.inputElement, + field: document.createElement("input"), + trigger: this.$.datePicker.inputElement, onSelect: this.hass.logbookActions.changeCurrentDate, }); + // Set the initial datePicker date, without triggering onSelect handler. + this.datePicker.setDate(this.selectedDate, true); }, detached: function () { From 77e8c78d62669f31aa0ac34f3411e55962b65f4c Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Tue, 26 Jul 2016 14:05:06 -0400 Subject: [PATCH 6/8] travis fixes --- panels/history/ha-panel-history.html | 2 +- panels/logbook/ha-panel-logbook.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index 00ac7e1264..ac911f6185 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -132,7 +132,7 @@ Polymer({ attached: function () { this.datePicker = new window.Pikaday({ - field: document.createElement("input"), + field: document.createElement('input'), trigger: this.$.datePicker.inputElement, onSelect: this.hass.entityHistoryActions.changeCurrentDate, }); diff --git a/panels/logbook/ha-panel-logbook.html b/panels/logbook/ha-panel-logbook.html index bc61fc4662..629a05e4ea 100644 --- a/panels/logbook/ha-panel-logbook.html +++ b/panels/logbook/ha-panel-logbook.html @@ -139,7 +139,7 @@ Polymer({ attached: function () { this.datePicker = new window.Pikaday({ - field: document.createElement("input"), + field: document.createElement('input'), trigger: this.$.datePicker.inputElement, onSelect: this.hass.logbookActions.changeCurrentDate, }); From 1a8832099c52d4e62c82bb0fad428b1a873a4201 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Tue, 26 Jul 2016 14:11:20 -0400 Subject: [PATCH 7/8] Include submodule reference --- home-assistant-js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-assistant-js b/home-assistant-js index b7ac88af0b..114f8ad651 160000 --- a/home-assistant-js +++ b/home-assistant-js @@ -1 +1 @@ -Subproject commit b7ac88af0bf5a6065c021e47dc6af0f7006b187b +Subproject commit 114f8ad6517744889b2a013a6b4836e89083df4a From b3efdd9efa95822bebd2e2766c19f276ada3042f Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Wed, 27 Jul 2016 14:27:27 -0400 Subject: [PATCH 8/8] Additional comments for pikaday field binding --- panels/history/ha-panel-history.html | 2 ++ panels/logbook/ha-panel-logbook.html | 2 ++ 2 files changed, 4 insertions(+) diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index ac911f6185..60e800dccd 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -132,6 +132,8 @@ Polymer({ attached: function () { this.datePicker = new window.Pikaday({ + // Bind field to dummy input to prevent pikaday from overwriting + // field value with its internal formatting. field: document.createElement('input'), trigger: this.$.datePicker.inputElement, onSelect: this.hass.entityHistoryActions.changeCurrentDate, diff --git a/panels/logbook/ha-panel-logbook.html b/panels/logbook/ha-panel-logbook.html index 629a05e4ea..f3a8279c5b 100644 --- a/panels/logbook/ha-panel-logbook.html +++ b/panels/logbook/ha-panel-logbook.html @@ -139,6 +139,8 @@ Polymer({ attached: function () { this.datePicker = new window.Pikaday({ + // Bind field to dummy input to prevent pikaday from overwriting + // field value with its internal formatting. field: document.createElement('input'), trigger: this.$.datePicker.inputElement, onSelect: this.hass.logbookActions.changeCurrentDate,