Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

set min date starting date an hour before current date

Edward Plato6580d4cc0d6d
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 44b5b6fdb..42483af1b 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -1188,6 +1188,10 @@ export default (function (self) {
dateArray.push(new Date(minDate.getUTCFullYear(), minDate.getUTCMonth(), minDate.getUTCDate() + dateInterval, 0, 0, 0));
}
} else if (def.period === 'subdaily') {
+ const minDateMinutes = minDate.getUTCMinutes();
+ // only check an hour into past for min date
+ const hourBeforeCurrentDate = new Date(currentDate.setMinutes(minDateMinutes) - (currentDate.getTimezoneOffset() * 60000) - (60 * 60000));
+ minDate = hourBeforeCurrentDate < minDate ? minDate : hourBeforeCurrentDate;
// if containgeRange is true, check if date is between current dateRange.startDate && dateRange.endDate
if (!containRange) {
minuteDifference = self.minuteDiff(minDate, maxMinuteDate);