diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index ecda5a53..d872ee01 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -296,11 +296,11 @@ Module.register("weatherforecast", { let numberOfDays; if (this.config.forecastEndpoint === "forecast") { - numberOfDays = (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 5 ? 5 : this.config.maxNumberOfDays); + 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.ceil(new Date().getHours() / 3) % 8; + numberOfDays = numberOfDays * 8 - (Math.floor(new Date().getHours() / 3) % 8); } else { - numberOfDays = (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17) ? 7 : this.config.maxNumberOfDays; + numberOfDays = this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays; } params += "&cnt=" + numberOfDays;