Show correct units for showRainAmount

This commit is contained in:
Michael Teeuw 2017-01-15 21:16:01 +01:00
parent 865dce6f68
commit a4cb53fdb4
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Remove white flash on boot up. - Remove white flash on boot up.
- Added `update` in Raspberry Pi installation script. - Added `update` in Raspberry Pi installation script.
- Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611)) - 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 ## [2.1.0] - 2016-12-31

View File

@ -150,7 +150,11 @@ Module.register("weatherforecast",{
if (isNaN(forecast.rain)) { if (isNaN(forecast.rain)) {
rainCell.innerHTML = ""; rainCell.innerHTML = "";
} else { } 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"; rainCell.className = "align-right bright rain";
row.appendChild(rainCell); row.appendChild(rainCell);