#5761 fix weather forecast card showing hours instead of weekdays (#5799)

This commit is contained in:
optama 2020-05-07 23:19:50 +02:00 committed by GitHub
parent 05ac275780
commit e83ede245d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;