From 5dc48738e6f2800fde963a7581e200bd4de18463 Mon Sep 17 00:00:00 2001
From: Jakob Stendahl <jakob.stendahl@outlook.com>
Date: Thu, 28 Apr 2022 10:51:09 +0200
Subject: Add 27-day outlook

---
 src/components/Forecast/OneHourForecast/OneHourForecast.svelte | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/components/Forecast/OneHourForecast/OneHourForecast.svelte')

diff --git a/src/components/Forecast/OneHourForecast/OneHourForecast.svelte b/src/components/Forecast/OneHourForecast/OneHourForecast.svelte
index 3222dc8..062ffbd 100644
--- a/src/components/Forecast/OneHourForecast/OneHourForecast.svelte
+++ b/src/components/Forecast/OneHourForecast/OneHourForecast.svelte
@@ -37,10 +37,15 @@
                 let closestDate = new Date(0,0,0);
                 let temp;
                 let clouds;
+                let weatherData = true;
 
                 $earth_weather.yr_data_raw.properties.timeseries.forEach((earth_pred, i) => {
                     let predDate = new Date(earth_pred.time);
                     if (Math.abs(predDate.getTime() - pred.time.getTime()) < Math.abs(closestDate.getTime() - pred.time.getTime())) {
+                        if ((Math.abs(predDate.getTime() - pred.time.getTime())) > (3600 * 5 * 1000)) {
+                            weatherData = false;
+                            return;
+                        }
                         closestDate = predDate;
                         temp = (earth_pred["data"]["instant"]["details"]["air_temperature"]);
                         clouds = earth_pred["data"]["instant"]["details"]["cloud_area_fraction"];
@@ -48,7 +53,7 @@
                 });
 
                 predictions[i] = {
-                    ...predictions[i], "temp": temp, "clouds": clouds
+                    ...predictions[i], "temp": temp, "clouds": clouds, "hasNOMETData": weatherData
                 }
             });
         }
-- 
cgit v1.2.3

