weatherforecast rainfall rounding

This commit is contained in:
vincep5 2018-08-07 11:48:10 -05:00
parent 439027220b
commit 6598ae080f
2 changed files with 3 additions and 2 deletions

View File

@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Hungarian translation for "Feels" and "Week" - Hungarian translation for "Feels" and "Week"
- Spanish translation for "Feels" - Spanish translation for "Feels"
- Add classes instead of inline style to the message from the module Alert - Add classes instead of inline style to the message from the module Alert
- Fix for weatherforecast rainfall rounding [#1374](https://github.com/MichMich/MagicMirror/issues/1374)
### Fixed ### Fixed
- Mixup between german and spanish translation for newsfeed. - Mixup between german and spanish translation for newsfeed.

View File

@ -177,7 +177,7 @@ Module.register("weatherforecast",{
rainCell.innerHTML = ""; rainCell.innerHTML = "";
} else { } else {
if(config.units !== "imperial") { if(config.units !== "imperial") {
rainCell.innerHTML = forecast.rain + " mm"; rainCell.innerHTML = parseFloat(forecast.rain).toFixed(1) + " mm";
} else { } else {
rainCell.innerHTML = (parseFloat(forecast.rain) / 25.4).toFixed(2) + " in"; rainCell.innerHTML = (parseFloat(forecast.rain) / 25.4).toFixed(2) + " in";
} }
@ -350,7 +350,7 @@ Module.register("weatherforecast",{
icon: this.config.iconTable[forecast.weather[0].icon], icon: this.config.iconTable[forecast.weather[0].icon],
maxTemp: this.roundValue(forecast.temp.max), maxTemp: this.roundValue(forecast.temp.max),
minTemp: this.roundValue(forecast.temp.min), minTemp: this.roundValue(forecast.temp.min),
rain: this.roundValue(forecast.rain) rain: forecast.rain
}; };
this.forecast.push(forecastData); this.forecast.push(forecastData);