Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Change 'addedTime' to 'futureTime', update conditionals

ZachTRice8df130a60f4f
diff --git a/doc/configuration.md b/doc/configuration.md
index 4715dbec2..f582cd662 100644
--- a/doc/configuration.md
+++ b/doc/configuration.md
@@ -73,8 +73,8 @@ The following properties are required if this information is not available via t
- **startDate**: The first day that data is available, represented in YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format.
- **endDate**: The last day that data is available, represented in YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format.
- **inactive**: Use *true* if the layer is no longer being produced.
-- **futurelayer**: Use *true* if the layer has an end date after the current date.
-- **addedTime**: Use `[number][type="D,M,Y"]` (i.e. "3D") with the `futurelayer` parameter to denote a layer that has a dynamic, future end date. The `[number]` parameter represents the dateInterval, `[type]` can be equal to `"D"`, `"M"`, or `"Y"` to represent day, month or year interval.
+- **futureLayer**: Use *true* if the layer has an end date after the current date.
+- **futureTime**: Use `[number][type="D,M,Y"]` (i.e. "3D") with the `futurelayer` parameter to denote a layer that has a dynamic, future end date. The `[number]` parameter represents the dateInterval, `[type]` can be equal to `"D"`, `"M"`, or `"Y"` to represent day, month or year interval.
A *projections* object must exist which contains an object for each projection supported by this layer. Projection information is keyed by the projection identifier (found in `config/wv.json/projections`). Example:
diff --git a/tasks/validateOptions.py b/tasks/validateOptions.py
index 18ab6fb7d..87381202f 100755
--- a/tasks/validateOptions.py
+++ b/tasks/validateOptions.py
@@ -126,10 +126,10 @@ for layer_id in wv["layers"].keys():
if "temporal" in layer:
warn("[%s] GC Layer temporal values overwritten by Options" % layer_id)
layer = process_temporal(layer, layer["temporal"])
- if layer.get("addedTime"):
+ if layer.get("futureTime"):
if "endDate" in layer:
del layer["endDate"]
- if layer.get("inactive", False) or layer.get("futurelayer", False):
+ if layer.get("inactive", False) or layer.get("futureLayer", False):
pass
else:
if "endDate" in layer:
diff --git a/web/js/layers/model.js b/web/js/layers/model.js
index 46c7e1186..be7d62141 100644
--- a/web/js/layers/model.js
+++ b/web/js/layers/model.js
@@ -145,7 +145,7 @@ export function layersModel(models, config) {
}
// For now, we assume that any layer with an end date is
// an ongoing product unless it is marked as inactive.
- if (def.futurelayer & def.endDate) {
+ if (def.futureLayer && def.endDate) {
range = true;
max = util.parseDateUTC(def.endDate).getTime();
maxDates.push(new Date(max));
@@ -162,30 +162,33 @@ export function layersModel(models, config) {
// If there is a start date but no end date, this is a
// product that is currently being created each day, set
// the max day to today.
- if (def.futurelayer && def.addedTime && !def.endDate) {
- // Calculate endDate + parsed addedTime from layer JSON
- max = util.now().getTime();
- max = new Date(max);
- var addedTime = def.addedTime;
- var dateType = addedTime.slice(-1);
- var dateInterval = addedTime.slice(0, -1);
+ if (def.futureLayer && def.futureTime && !def.endDate) {
+ // Calculate endDate + parsed futureTime from layer JSON
+ max = new Date();
+ var futureTime = def.futureTime;
+ var dateType = futureTime.slice(-1);
+ var dateInterval = futureTime.slice(0, -1);
if (dateType === 'D') {
- max.setDate(max.getDate() + dateInterval);
+ max.setDate(max.getDate() + parseInt(dateInterval));
+ maxDates.push(new Date(max));
} else if (dateType === 'M') {
- max.setMonth(max.getMonth() + dateInterval);
+ max.setMonth(max.getMonth() + parseInt(dateInterval));
+ maxDates.push(new Date(max));
} else if (dateType === 'Y') {
- max.setYear(max.getYear() + dateInterval);
+ max.setYear(max.getYear() + parseInt(dateInterval));
+ maxDates.push(new Date(max));
}
} else if (def.startDate && !def.endDate) {
max = util.now().getTime();
+ maxDates.push(new Date(max));
}
});
if (range) {
if (max === 0) {
max = util.now().getTime();
- maxDates.push(new Date(max));
+ maxDates.push(max);
}
- var maxDate = new Date(Math.max.apply(null, maxDates));
+ var maxDate = Math.max.apply(max, maxDates);
return {
start: new Date(min),
end: new Date(maxDate)