Skip to content

Commit

Permalink
refactor: set leadingEdgeDate to 59 seconds to make date handling mor…
Browse files Browse the repository at this point in the history
…e intuitive.
  • Loading branch information
PatchesMaps committed Aug 12, 2024
1 parent f81598d commit 5c94027
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions web/js/map/granule/granule-layer-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5c94027

Please sign in to comment.