Support ss/SS case-insensitive; convert units based on CONFIG.units
This commit is contained in:
1 parent
d3ccd6f70d
commit
661542117c
1 file changed
+10
-3
+10
-3
@@ -895,7 +895,7 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
|
||||
} else if (ch === 's' && format.substr(i, 3) === 'sss') {
|
||||
result += pad3(date.getMilliseconds());
|
||||
i += 3;
|
||||
} else if (ch === 's' && format.substr(i, 2) === 'ss') {
|
||||
} else if ((ch === 's' || ch === 'S') && format.substr(i, 2).toLowerCase() === 'ss') {
|
||||
result += pad2(date.getSeconds());
|
||||
i += 2;
|
||||
} else if (ch === 'a' && format.substr(i, 4) === 'aaaa') {
|
||||
@@ -1742,10 +1742,17 @@ window.weatherThemes = {
|
||||
var daily = weatherData.daily;
|
||||
|
||||
// Current
|
||||
var currentUnits = (window.CONFIG && window.CONFIG.units) || 'metric';
|
||||
var tempDisplay = currentUnits === 'imperial'
|
||||
? Math.round(current.temperature_2m * 9 / 5 + 32) + '\u00b0F'
|
||||
: Math.round(current.temperature_2m) + '\u00b0C';
|
||||
var windDisplay = currentUnits === 'imperial'
|
||||
? Math.round(current.wind_speed_10m * 0.621371) + ' mph'
|
||||
: Math.round(current.wind_speed_10m) + ' km/h';
|
||||
var currentHtml = '<div class="weather-current-icon">' + weatherSVG(current.weather_code) + '</div>' +
|
||||
'<div><div class="weather-current-temp">' + Math.round(current.temperature_2m) + '°C</div>' +
|
||||
'<div><div class="weather-current-temp">' + tempDisplay + '</div>' +
|
||||
'<div class="weather-current-detail">' +
|
||||
t('Humidity') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + Math.round(current.wind_speed_10m) + ' km/h</div></div>';
|
||||
t('Humidity') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + windDisplay + '</div></div>';
|
||||
document.getElementById('weather-current').innerHTML = currentHtml;
|
||||
|
||||
// Forecast
|
||||
|
||||
Reference in new issue
Block a user