Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Only update current range & check for current date in closest date array

ZachTRice5509e4d04c34
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 2241af879..525b28419 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -313,7 +313,7 @@ export function mapui(models, config) {
if (isGraticule(def)) {
addGraticule();
} else {
- def.availableDates = util.datesinDateRanges(def, date, false);
+ def.availableDates = util.datesinDateRanges(def, date, true);
self.selected.getLayers()
.insertAt(mapIndex, createLayer(def));
}
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 1c31af9c1..b6c542918 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -15,6 +15,7 @@ import load from './load';
import Cache from 'cachai';
import closestTo from 'date-fns/closest_to';
import isBefore from 'date-fns/is_before';
+import isEqual from 'date-fns/is_equal';
export default (function (self) {
var canvas = null;
@@ -930,7 +931,7 @@ export default (function (self) {
// Return an array of the closest available dates within the range
var closestAvailableDates = [];
lodashEach(dateArray, function(rangeDate) {
- if (isBefore(rangeDate, currentDate)) {
+ if (isBefore(rangeDate, currentDate) || isEqual(rangeDate, currentDate)) {
closestAvailableDates.push(rangeDate);
}
});