From e83ede245d5656ddcc3267144b907d150afe10a6 Mon Sep 17 00:00:00 2001 From: optama <509056+optama@users.noreply.github.com> Date: Thu, 7 May 2020 23:19:50 +0200 Subject: [PATCH] #5761 fix weather forecast card showing hours instead of weekdays (#5799) --- src/panels/lovelace/cards/hui-weather-forecast-card.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/cards/hui-weather-forecast-card.ts b/src/panels/lovelace/cards/hui-weather-forecast-card.ts index 1909c704dd..2d9adf3356 100644 --- a/src/panels/lovelace/cards/hui-weather-forecast-card.ts +++ b/src/panels/lovelace/cards/hui-weather-forecast-card.ts @@ -150,9 +150,9 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard { let hourly: boolean | undefined; - if (forecast?.length && forecast?.length > 1) { - const date1 = new Date(forecast[0].datetime); - const date2 = new Date(forecast[1].datetime); + if (forecast?.length && forecast?.length > 2) { + const date1 = new Date(forecast[1].datetime); + const date2 = new Date(forecast[2].datetime); const timeDiff = date2.getTime() - date1.getTime(); hourly = timeDiff < DAY_IN_MILLISECONDS;