Fix precipitation styles (#3041)

They weren't applied to wrong classnames, this PR fixes that and also
expands the weather util tests

---------

Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Veeck
2023-02-18 18:24:11 +01:00
committed by GitHub
parent 81244d961e
commit fb22a76796
8 changed files with 40 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ const WeatherUtils = {
* @returns {number} the speed in beaufort
*/
beaufortWindSpeed(speedInMS) {
const windInKmh = (speedInMS * 3600) / 1000;
const windInKmh = this.convertWind(speedInMS, "kmh");
const speeds = [1, 5, 11, 19, 28, 38, 49, 61, 74, 88, 102, 117, 1000];
for (const [index, speed] of speeds.entries()) {
if (speed > windInKmh) {
@@ -40,6 +40,8 @@ const WeatherUtils = {
valueUnit = valueUnit ? valueUnit : "mm";
}
if (valueUnit === "%") return `${value}${valueUnit}`;
return `${value.toFixed(2)} ${valueUnit}`;
},