Interactive interface for browsing global, full-resolution satellite imagery
add max date for subdaily range
Edward Plato63ad148c924b
diff --git a/web/js/util/util.js b/web/js/util/util.jsindex 42483af1b..f7a2cd961 100644--- a/web/js/util/util.js+++ b/web/js/util/util.js@@ -1188,10 +1188,16 @@ export default (function (self) {dateArray.push(new Date(minDate.getUTCFullYear(), minDate.getUTCMonth(), minDate.getUTCDate() + dateInterval, 0, 0, 0));}} else if (def.period === 'subdaily') {+ const currentDateOffset = currentDate.getTimezoneOffset() * 60000;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));+ const hourBeforeCurrentDate = new Date(currentDate.setMinutes(minDateMinutes) - currentDateOffset - (60 * 60000));minDate = hourBeforeCurrentDate < minDate ? minDate : hourBeforeCurrentDate;+ // only check an hour into future for max date+ const hourAfterCurrentDate = new Date(currentDate.setMinutes(minDateMinutes) - currentDateOffset + (60 * 60000));+ maxMinuteDate = hourAfterCurrentDate > maxMinuteDate ? maxMinuteDate : hourAfterCurrentDate;++ currentDate = new Date(currentDate.getTime() - currentDateOffset);// if containgeRange is true, check if date is between current dateRange.startDate && dateRange.endDateif (!containRange) {minuteDifference = self.minuteDiff(minDate, maxMinuteDate);