From 4ef2ed312c2ef0d7db17b513ae170d15a2c0b1ec Mon Sep 17 00:00:00 2001 From: Patrick Kissling Date: Tue, 1 Nov 2022 08:58:08 +0100 Subject: [PATCH] Fix zero degree temps not displayed properly --- src/clock-weather-card.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/clock-weather-card.ts b/src/clock-weather-card.ts index fb51c972..fa8ca9ce 100644 --- a/src/clock-weather-card.ts +++ b/src/clock-weather-card.ts @@ -451,16 +451,16 @@ export class ClockWeatherCard extends LitElement { } private calculateAverageDailyForecast(forecasts: WeatherForecast[]): MergedWeatherForecast { - const minTemps = forecasts.map((f) => f.templow || f.temperature || this.getWeather().attributes.temperature); + const minTemps = forecasts.map((f) => f.templow ?? f.temperature ?? this.getWeather().attributes.temperature); const minTemp = min(minTemps); - const maxTemps = forecasts.map((f) => f.temperature || this.getWeather().attributes.temperature); + const maxTemps = forecasts.map((f) => f.temperature ?? this.getWeather().attributes.temperature); const maxTemp = max(maxTemps); - const precipitationProbabilities = forecasts.map((f) => f.precipitation_probability || 0); + const precipitationProbabilities = forecasts.map((f) => f.precipitation_probability ?? 0); const precipitationProbability = max(precipitationProbabilities); - const precipitations = forecasts.map((f) => f.precipitation || 0); + const precipitations = forecasts.map((f) => f.precipitation ?? 0); const precipitation = max(precipitations); const conditions = forecasts.map((f) => f.condition);