From 8a2907e02c83f7fb142a616a8889b87a48ac7981 Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Fri, 27 Jun 2025 15:35:15 -0500 Subject: [PATCH] fix display of null wind speed --- server/scripts/modules/currentweather.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/scripts/modules/currentweather.mjs b/server/scripts/modules/currentweather.mjs index 4280c1a..b09d216 100644 --- a/server/scripts/modules/currentweather.mjs +++ b/server/scripts/modules/currentweather.mjs @@ -112,10 +112,12 @@ class CurrentWeather extends WeatherDisplay { condition = shortConditions(condition); } + const wind = (typeof this.data.WindSpeed === 'number') ? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ') : '-'; + const fill = { temp: this.data.Temperature + String.fromCharCode(176), condition, - wind: this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' '), + wind, location: locationCleanup(this.data.station.properties.name).substr(0, 20), humidity: `${this.data.Humidity}%`, dewpoint: this.data.DewPoint + String.fromCharCode(176), @@ -202,7 +204,6 @@ const parseData = (data) => { data.WindSpeed = windConverter(observations.windSpeed.value); data.WindDirection = directionToNSEW(observations.windDirection.value); data.WindGust = windConverter(observations.windGust.value); - data.WindSpeed = windConverter(data.WindSpeed); data.WindUnit = windConverter.units; data.Humidity = Math.round(observations.relativeHumidity.value); data.Icon = getLargeIcon(observations.icon);