From 661542117c4c0fc9702c237694c17fffff2e8bad Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 7 Oct 2026 14:12:10 +0200 Subject: [PATCH] Support ss/SS case-insensitive; convert units based on CONFIG.units --- index.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index fc4f60c..0127897 100644 --- a/index.html +++ b/index.html @@ -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 = '
' + weatherSVG(current.weather_code) + '
' + - '
' + Math.round(current.temperature_2m) + '°C
' + + '
' + tempDisplay + '
' + '
' + - t('Humidity') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + Math.round(current.wind_speed_10m) + ' km/h
'; + t('Humidity') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + windDisplay + '
'; document.getElementById('weather-current').innerHTML = currentHtml; // Forecast