From effb47de024064075b1f31e6c9da9850f31b2ea0 Mon Sep 17 00:00:00 2001 From: ryanweiler92 Date: Mon, 8 Jan 2024 12:37:45 -0500 Subject: [PATCH 1/2] check for layers in settings array that dont exist in config --- web/js/modules/product-picker/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/modules/product-picker/selectors.js b/web/js/modules/product-picker/selectors.js index 507ece0c8e..feca2368b4 100644 --- a/web/js/modules/product-picker/selectors.js +++ b/web/js/modules/product-picker/selectors.js @@ -43,7 +43,7 @@ export const getSourcesForProjection = createSelector( const trackGroup = currentMeasurement && currentMeasurement.id === 'orbital-track'; const sourcesForProj = sources && sources.filter( (source) => source.settings.some((layerId) => { - if (!config.layers[layerId].projections) return; + if (!config.layers[layerId] || !config.layers[layerId].projections) return; const { projections, layergroup } = config.layers[layerId]; const isOrbitTrack = layergroup === 'Orbital Track'; const inProj = !!projections[projection]; From 7be844e99da394eb0f1433f24bcf58d54d360dbe Mon Sep 17 00:00:00 2001 From: ryanweiler92 Date: Wed, 10 Jan 2024 12:05:33 -0500 Subject: [PATCH 2/2] handle adjusting startDate errors --- web/js/modules/layers/util.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.js index 22895a5f4a..9fb1ff4358 100644 --- a/web/js/modules/layers/util.js +++ b/web/js/modules/layers/util.js @@ -1412,7 +1412,7 @@ export function adjustStartDates(layers) { .format('YYYY-MM-DDThh:mm:ss')}Z`; const applyDateAdjustment = (layer) => { - const { availability, dateRanges } = layer; + const { availability, dateRanges, endDate } = layer; if (!availability) { return; } @@ -1420,8 +1420,15 @@ export function adjustStartDates(layers) { if (Array.isArray(dateRanges) && dateRanges.length) { const [firstDateRange] = dateRanges; - firstDateRange.startDate = adjustDate(rollingWindow); - layer.startDate = adjustDate(rollingWindow); + const adjustedDate = adjustDate(rollingWindow); + + // To prevent a startDate greater than endDate for layers with a rollingWindow and specific start and end dates + if (endDate && new Date(adjustedDate) > new Date(endDate)) { + return; + } + + firstDateRange.startDate = adjustedDate; + layer.startDate = adjustedDate; } else { console.warn(`GetCapabilities is missing the time value for ${layer.id}`); }