From 5c94027b58dc221797542dcfaa53b60baa02a690 Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Mon, 12 Aug 2024 14:39:59 -0400 Subject: [PATCH] refactor: set leadingEdgeDate to 59 seconds to make date handling more intuitive. --- web/js/map/granule/granule-layer-builder.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/js/map/granule/granule-layer-builder.js b/web/js/map/granule/granule-layer-builder.js index 0785208861..6a27dfbe83 100644 --- a/web/js/map/granule/granule-layer-builder.js +++ b/web/js/map/granule/granule-layer-builder.js @@ -64,6 +64,7 @@ export default function granuleLayerBuilder(cache, store, createLayerWMTS) { * Query CMR to get dates * @param {object} def - Layer specs * @param {object} selectedDate - current selected date (Note: may not return this date, but this date will be the max returned) + * @returns {array} granule dates */ const getQueriedGranuleDates = async (def, selectedDate) => { const { @@ -176,6 +177,7 @@ export default function granuleLayerBuilder(cache, store, createLayerWMTS) { const { date } = item; const dateDate = new Date(date); const leadingEdgeDateUTC = new Date(leadingEdgeDate.toUTCString()); + leadingEdgeDateUTC.setSeconds(59); const isWithinRange = isWithinRanges(leadingEdgeDateUTC, granuleDateRanges); if (dateDate <= leadingEdgeDateUTC && isWithinRange && isWithinBounds(crs, item)) { granules.unshift(item);