mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 20:22:53 +00:00
Merge pull request #2066 from oemel09/fix-maxNumberOfDays-2018
Adjusts maxNumberOfDays depending on the endpoint
This commit is contained in:
commit
37237d9c10
@ -17,6 +17,8 @@ _This release is scheduled to be released on 2020-10-01._
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fix the use of "maxNumberOfDays" in the module "weatherforecast depending on the endpoint (forecast/daily or forecast)". [#2018](https://github.com/MichMich/MagicMirror/issues/2018)
|
||||||
|
|
||||||
## [2.12.0] - 2020-07-01
|
## [2.12.0] - 2020-07-01
|
||||||
|
|
||||||
Special thanks to the following contributors: @AndreKoepke, @andrezibaia, @bryanzzhu, @chamakura, @DarthBrento, @Ekristoffe, @khassel, @Legion2, @ndom91, @radokristof, @rejas, @XBCreepinJesus & @ZoneMR.
|
Special thanks to the following contributors: @AndreKoepke, @andrezibaia, @bryanzzhu, @chamakura, @DarthBrento, @Ekristoffe, @khassel, @Legion2, @ndom91, @radokristof, @rejas, @XBCreepinJesus & @ZoneMR.
|
||||||
|
@ -294,7 +294,15 @@ Module.register("weatherforecast", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
params += "&cnt=" + (this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays);
|
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);
|
||||||
|
} else {
|
||||||
|
numberOfDays = this.config.maxNumberOfDays < 1 || this.config.maxNumberOfDays > 17 ? 7 : this.config.maxNumberOfDays;
|
||||||
|
}
|
||||||
|
params += "&cnt=" + numberOfDays;
|
||||||
|
|
||||||
params += "&units=" + this.config.units;
|
params += "&units=" + this.config.units;
|
||||||
params += "&lang=" + this.config.lang;
|
params += "&lang=" + this.config.lang;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user