mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 20:22:53 +00:00
Adjusts maxNumberOfDays depending on the endpoint
This commit is contained in:
parent
26ed05ba3a
commit
0939e405b4
@ -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.ceil(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