From 0be5aa108c21021afb7f5a47d08208de515b75f9 Mon Sep 17 00:00:00 2001 From: Bruno Luvizotto Date: Tue, 9 May 2023 07:32:13 -0300 Subject: [PATCH] Fix history redraw timer (#16472) --- src/panels/history/ha-panel-history.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panels/history/ha-panel-history.ts b/src/panels/history/ha-panel-history.ts index fb2e74299b..08b8f0d90c 100644 --- a/src/panels/history/ha-panel-history.ts +++ b/src/panels/history/ha-panel-history.ts @@ -360,7 +360,7 @@ class HaPanelHistory extends SubscribeMixin(LitElement) { clearInterval(this._interval); const now = new Date(); const end = this._endDate > now ? now : this._endDate; - const timespan = differenceInHours(this._startDate, end); + const timespan = differenceInHours(end, this._startDate); this._interval = window.setInterval( () => this._stateHistoryCharts?.requestUpdate(), // if timespan smaller than 1 hour, update every 10 seconds, smaller than 5 hours, redraw every minute, otherwise every 5 minutes