1
0
Fork 0

Minor fix.

master
David Peer 2022-02-11 07:55:05 +01:00
parent 5c9f84d00e
commit ce1d0a4e96
1 changed files with 23 additions and 23 deletions

View File

@ -482,31 +482,31 @@ function getWeather(){
// Return default
}
if(weatherJson){
var weather = weatherJson.weather;
// Temperature
const temp = locale.temp(weather.temp-273.15).match(/^(\D*\d*)(.*)$/);
weather.temp = temp[1] + " " + temp[2].toUpperCase();
// Humidity
weather.hum = weather.hum + "%";
// Wind
const wind = locale.speed(weather.wind).match(/^(\D*\d*)(.*)$/);
weather.wind = wind[1] + wind[2].toUpperCase();
return weather
if(weatherJson === undefined){
return {
temp: "-",
hum: "-",
txt: "-",
wind: "-",
wdir: "-",
wrose: "-"
};
}
return {
temp: "-",
hum: "-",
txt: "-",
wind: "-",
wdir: "-",
wrose: "-"
};
var weather = weatherJson.weather;
// Temperature
const temp = locale.temp(weather.temp-273.15).match(/^(\D*\d*)(.*)$/);
weather.temp = temp[1] + " " + temp[2].toUpperCase();
// Humidity
weather.hum = weather.hum + "%";
// Wind
const wind = locale.speed(weather.wind).match(/^(\D*\d*)(.*)$/);
weather.wind = wind[1]; // + wind[2].toUpperCase(); // Don't show mph - its too large
return weather
}