From 6598ae080fe06e01f110cad0d45429ec7c3c7e42 Mon Sep 17 00:00:00 2001 From: vincep5 Date: Tue, 7 Aug 2018 11:48:10 -0500 Subject: [PATCH] weatherforecast rainfall rounding --- CHANGELOG.md | 1 + modules/default/weatherforecast/weatherforecast.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b8c087c..5c6953d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Hungarian translation for "Feels" and "Week" - Spanish translation for "Feels" - 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 - Mixup between german and spanish translation for newsfeed. diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index c06f5f5b..19e004ff 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -177,7 +177,7 @@ Module.register("weatherforecast",{ rainCell.innerHTML = ""; } else { if(config.units !== "imperial") { - rainCell.innerHTML = forecast.rain + " mm"; + rainCell.innerHTML = parseFloat(forecast.rain).toFixed(1) + " mm"; } else { 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], maxTemp: this.roundValue(forecast.temp.max), minTemp: this.roundValue(forecast.temp.min), - rain: this.roundValue(forecast.rain) + rain: forecast.rain }; this.forecast.push(forecastData);