Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add testNow param to date reducer and refactor now in location to use testNow

Edward Platoceb517a13014
diff --git a/web/js/location.js b/web/js/location.js
index dbf3bdbd3..f70d10b01 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -95,7 +95,6 @@ export const mapLocationToState = (state, location) => {
const getParameters = function(config, parameters) {
const now = config.pageLoadTime;
const nowMinusSevenDays = util.dateAdd(config.pageLoadTime, 'day', -7);
- let TEST_NOW = '';
return {
p: {
stateKey: 'proj.id',
@@ -108,11 +107,12 @@ const getParameters = function(config, parameters) {
options: {
serializeNeedsGlobalState: false,
setAsEmptyItem: true,
- serialize: () => {
- return TEST_NOW || undefined;
+ serialize: (currentItemState) => {
+ return currentItemState
+ ? util.toISOStringSeconds(currentItemState)
+ : undefined;
},
parse: str => {
- TEST_NOW = str;
return tryCatchDate(str, now);
}
}
diff --git a/web/js/modules/date/reducers.js b/web/js/modules/date/reducers.js
index 2f8b880eb..5cb5581a9 100644
--- a/web/js/modules/date/reducers.js
+++ b/web/js/modules/date/reducers.js
@@ -14,7 +14,8 @@ export const dateReducerState = {
delta: 1,
customSelected: false,
customDelta: undefined,
- customInterval: undefined
+ customInterval: undefined,
+ testNow: undefined
};
export function getInitialState(config) {