From 43eb760bce66d896327cd13c56cbb2b8e7053e93 Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 31 Aug 2021 22:01:30 +0200 Subject: [PATCH] Use isDayTime method --- modules/default/weather/providers/weathergov.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/default/weather/providers/weathergov.js b/modules/default/weather/providers/weathergov.js index 9dc1fddf..65600ad3 100755 --- a/modules/default/weather/providers/weathergov.js +++ b/modules/default/weather/providers/weathergov.js @@ -158,17 +158,12 @@ WeatherProvider.register("weathergov", { currentWeather.precipitation = this.convertLength(currentWeatherData.precipitationLastHour.value); currentWeather.feelsLikeTemp = this.convertTemp(currentWeatherData.heatIndex.value); - let isDaytime = true; - if (currentWeatherData.icon.includes("day")) { - isDaytime = true; - } else { - isDaytime = false; - } - currentWeather.weatherType = this.convertWeatherType(currentWeatherData.textDescription, isDaytime); - // determine the sunrise/sunset times - not supplied in weather.gov data currentWeather.updateSunTime(this.config.lat, this.config.lon); + // update weatherType + currentWeather.weatherType = this.convertWeatherType(currentWeatherData.textDescription, currentWeather.isDayTime()); + return currentWeather; },