From 7967ab307c93abf602139aab2cbd4e67a958bdaf Mon Sep 17 00:00:00 2001 From: Charles Garwood Date: Thu, 5 Apr 2018 22:51:48 -0400 Subject: [PATCH] Adds date to systemlog entries (#1068) * Adds date to systemlog entries * Only return date if not today * Fix lint * Fix lint * Address comments by c727 * tested and working this time * fix lint * remove unneeded formatDateTime function --- panels/dev-info/ha-panel-dev-info.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/panels/dev-info/ha-panel-dev-info.html b/panels/dev-info/ha-panel-dev-info.html index c54c304511..15a5c524f1 100644 --- a/panels/dev-info/ha-panel-dev-info.html +++ b/panels/dev-info/ha-panel-dev-info.html @@ -57,6 +57,7 @@ @apply --paper-font-code) clear: both; white-space: pre-wrap; + margin: 16px; } .system-log-intro { @@ -309,7 +310,12 @@ class HaPanelDevInfo extends Polymer.Element { } formatTime(date) { - return window.hassUtil.formatTime(new Date(date * 1000)); + const today = new Date().setHours(0, 0, 0, 0); + const dateTime = new Date(date * 1000); + const dateTimeDay = new Date(date * 1000).setHours(0, 0, 0, 0); + + return dateTimeDay < today ? + window.hassUtil.formatDateTime(dateTime) : window.hassUtil.formatTime(dateTime); } openLog(event) {