From a1708a14697bb9a548e0e92f1fe3bb7197b497d5 Mon Sep 17 00:00:00 2001 From: oemel09 Date: Wed, 8 Jul 2020 10:19:49 +0200 Subject: [PATCH] Fixes getting only full day forecasts --- modules/default/weatherforecast/weatherforecast.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index d872ee01..874c48fe 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -297,8 +297,8 @@ Module.register("weatherforecast", { let numberOfDays; if (this.config.forecastEndpoint === "forecast") { numberOfDays = this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 5 ? 5 : this.config.maxNumberOfDays; - // don't get forecasts for the 6th day, as it would not represent the whole day - numberOfDays = numberOfDays * 8 - (Math.floor(new Date().getHours() / 3) % 8); + // don't get forecasts for the next day, as it would not represent the whole day + numberOfDays = numberOfDays * 8 - (Math.round(new Date().getHours() / 3) % 8); } else { numberOfDays = this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays; }