Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

change initial date to minus one day if utc hour less than 3, fixes #1800

Edward Plato478625460b5a
diff --git a/web/js/location.js b/web/js/location.js
index cba3136a0..75bad03a9 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -115,6 +115,11 @@ export const mapLocationToState = (state, location) => {
const getParameters = function(config, parameters) {
const now = config.pageLoadTime;
const nowMinusSevenDays = util.dateAdd(config.pageLoadTime, 'day', -7);
+ // If at the beginning of the day, wait on the previous day until GIBS
+ // catches up (about three hours)
+ let initialDate = now.getUTCHours() < 3
+ ? new Date(now).setUTCDate(now.getUTCDate() - 1)
+ : now;
return {
p: {
stateKey: 'proj.id',
@@ -144,7 +149,7 @@ const getParameters = function(config, parameters) {
},
t: {
stateKey: 'date.selected',
- initialState: now,
+ initialState: new Date(initialDate),
type: 'date',
options: {
serializeNeedsGlobalState: true,