From a4cb53fdb4af6eaea652c3baa77a3cd92e4ebd49 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Sun, 15 Jan 2017 21:16:01 +0100 Subject: [PATCH] Show correct units for showRainAmount --- CHANGELOG.md | 1 + modules/default/weatherforecast/weatherforecast.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df41689b..e0caa6de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Remove white flash on boot up. - Added `update` in Raspberry Pi installation script. - Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611)) +- If units is set to imperial, the showRainAmount option of weatherforecast will show the correct unit. ## [2.1.0] - 2016-12-31 diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 9bd15ba8..0b389873 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -150,7 +150,11 @@ Module.register("weatherforecast",{ if (isNaN(forecast.rain)) { rainCell.innerHTML = ""; } else { - rainCell.innerHTML = forecast.rain + " mm"; + if(config.units !== "imperial") { + rainCell.innerHTML = forecast.rain + " mm"; + } else { + rainCell.innerHTML = (parseFloat(forecast.rain) / 25.4).toFixed(2) + " in"; + } } rainCell.className = "align-right bright rain"; row.appendChild(rainCell);