mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
fix rain amount information for different units and providers, documentation
This commit is contained in:
@@ -194,6 +194,12 @@ Module.register("weather",{
|
||||
value += "K";
|
||||
}
|
||||
}
|
||||
} else if (type === "rain") {
|
||||
if (isNaN(value)) {
|
||||
value = "";
|
||||
} else {
|
||||
value = `${value.toFixed(2)} ${this.config.units === "imperial" ? "in" : "mm"}`;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -202,17 +208,5 @@ Module.register("weather",{
|
||||
this.nunjucksEnvironment().addFilter("roundValue", function(value) {
|
||||
return this.roundValue(value);
|
||||
}.bind(this));
|
||||
|
||||
this.nunjucksEnvironment().addFilter("formatRain", function(value) {
|
||||
if (isNaN(value)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if(this.config.units === "imperial") {
|
||||
return `${(parseFloat(value) / 25.4).toFixed(2)} in`;
|
||||
} else {
|
||||
return `${parseFloat(value).toFixed(1)} mm`;
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user