From 4513b4d824151075d05c238128b27cdcbf6f9890 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Thu, 13 Aug 2020 11:14:32 -0600 Subject: [PATCH] Add today to forecast tab --- www/assets/js/toolbox_weather.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/www/assets/js/toolbox_weather.js b/www/assets/js/toolbox_weather.js index cbccc3c..6fca4e6 100644 --- a/www/assets/js/toolbox_weather.js +++ b/www/assets/js/toolbox_weather.js @@ -191,12 +191,12 @@ function loadWeather(reload) { // forecastItems = []; - for (var i = 1; i < resp.forecast.length; i++) { + for (var i = 0; i < resp.forecast.length; i++) { var low = (getStorage("units") == "metric" ? Math.round(ftoc(resp.forecast[i].temp.min)) : Math.round(resp.forecast[i].temp.min)); var high = (getStorage("units") == "metric" ? Math.round(ftoc(resp.forecast[i].temp.max)) + " °C" : Math.round(resp.forecast[i].temp.max) + " °F"); var precipcolor = precipChanceToColor(resp.forecast[i].precipitation.chance); forecastItems.push({ - day: formatTimestamp('l', resp.forecast[i].date), + day: (i == 0 ? "Today" : formatTimestamp('l', resp.forecast[i].date)), temps: low + " to " + high, uv_index: resp.forecast[i].uv_index, uv_color: uvIndexToColor(resp.forecast[i].uv_index), @@ -253,20 +253,20 @@ function loadWeather(reload) { $("#app").on("click", "#weather-forecast .forecast-uv-badge", function () { app.toast.show({ - text: " UV index", - position: "bottom", - destroyOnClose: true, - closeTimeout: 1000 * 3 - }); + text: " UV index", + position: "bottom", + destroyOnClose: true, + closeTimeout: 1000 * 3 + }); }); $("#app").on("click", "#weather-forecast .forecast-precip-badge", function () { app.toast.show({ - text: " Chance of precipitation", - position: "bottom", - destroyOnClose: true, - closeTimeout: 1000 * 3 - }); + text: " Chance of precipitation", + position: "bottom", + destroyOnClose: true, + closeTimeout: 1000 * 3 + }); }); function uvIndexToColor(index) {