Skip to content

Commit

Permalink
Fix zero degree temps not displayed properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Kissling authored and pkissling committed Nov 1, 2022
1 parent 0e09bbb commit 4ef2ed3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/clock-weather-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4ef2ed3

Please sign in to comment.