mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
fixed missing last day display in forecast/hourly
This commit is contained in:
parent
d6046d2422
commit
2dfb349609
@ -113,7 +113,6 @@ WeatherProvider.register("openweathermap", {
|
|||||||
for (const forecast of forecasts) {
|
for (const forecast of forecasts) {
|
||||||
|
|
||||||
if (date !== moment(forecast.dt, "X").format("YYYY-MM-DD")) {
|
if (date !== moment(forecast.dt, "X").format("YYYY-MM-DD")) {
|
||||||
// a new day
|
|
||||||
// calculate minimum/maximum temperature, specify rain amount
|
// calculate minimum/maximum temperature, specify rain amount
|
||||||
weather.minTemperature = Math.min.apply(null, minTemp);
|
weather.minTemperature = Math.min.apply(null, minTemp);
|
||||||
weather.maxTemperature = Math.max.apply(null, maxTemp);
|
weather.maxTemperature = Math.max.apply(null, maxTemp);
|
||||||
@ -135,9 +134,9 @@ WeatherProvider.register("openweathermap", {
|
|||||||
|
|
||||||
// select weather type by first forecast value of a day, is this reasonable?
|
// select weather type by first forecast value of a day, is this reasonable?
|
||||||
weather.weatherType = this.convertWeatherType(forecast.weather[0].icon);
|
weather.weatherType = this.convertWeatherType(forecast.weather[0].icon);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the same day as before
|
// the same day as before
|
||||||
// add values from forecast to corresponding variables
|
// add values from forecast to corresponding variables
|
||||||
minTemp.push(forecast.main.temp_min);
|
minTemp.push(forecast.main.temp_min);
|
||||||
@ -155,6 +154,13 @@ WeatherProvider.register("openweathermap", {
|
|||||||
rain += 0;
|
rain += 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// last day
|
||||||
|
// calculate minimum/maximum temperature, specify rain amount
|
||||||
|
weather.minTemperature = Math.min.apply(null, minTemp);
|
||||||
|
weather.maxTemperature = Math.max.apply(null, maxTemp);
|
||||||
|
weather.rain = rain;
|
||||||
|
// push weather information to days array
|
||||||
|
days.push(weather);
|
||||||
return days.slice(1);
|
return days.slice(1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user