Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Merge pull request #6465 from nasa-gibs/wv-3919-auto-interval-fix

christof-wittreicha12bfe81733f
diff --git a/web/js/modules/date/util.js b/web/js/modules/date/util.js
index 2f233066f..3016892b8 100644
--- a/web/js/modules/date/util.js
+++ b/web/js/modules/date/util.js
@@ -593,7 +593,11 @@ export function getNextImageryDelta(layers, date, signConstant) {
if (dateAObj < startDateObj) {
const possibleDelta = Math.ceil(((startDateObj - dateAObj) / 1000) / 60);
if (possibleDelta >= 1) {
- delta = possibleDelta;
+ const possibleDate = new Date(dateAObj.getTime() + (possibleDelta * 60000));
+ // Increase delta by 1 minute if it falls exactly on the starting date/time
+ const correctedDelta = startDateObj.getTime() === possibleDate.getTime()
+ ? possibleDelta + 1 : possibleDelta;
+ delta = correctedDelta;
hasDeltaChanged = true;
break;
}
@@ -630,7 +634,11 @@ export function getNextImageryDelta(layers, date, signConstant) {
if (dateAObj > endDateObj) {
const possibleDelta = Math.ceil(((dateAObj - endDateObj) / 1000) / 60);
if (possibleDelta >= minDelta) {
- delta = possibleDelta;
+ const possibleDate = new Date(dateAObj.getTime() - (possibleDelta * 60000));
+ // Increase delta by 1 minute if it falls exactly on the ending date/time
+ const correctedDelta = endDateObj.getTime() === possibleDate.getTime()
+ ? possibleDelta + 1 : possibleDelta;
+ delta = correctedDelta;
hasDeltaChanged = true;
break;
}