Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2631: Fix Incorrect Info Dates (#4163)

Tom Cariellofab5219c02e3
diff --git a/tasks/build-options/processTemporalLayer.js b/tasks/build-options/processTemporalLayer.js
index f91bcdaea..ca049dc3b 100644
--- a/tasks/build-options/processTemporalLayer.js
+++ b/tasks/build-options/processTemporalLayer.js
@@ -47,15 +47,14 @@ async function processTemporalLayer (wvLayer, value) {
}
if (end) {
endDate = moment(end, dateFormat).format('YYYY-MM-DDTHH:mm:ss[Z]')
- dateRangeEnd.push(endDate)
}
if (interval !== 'P1D') {
- endDate = moment(endDate).add(moment.duration(interval))
- dateRangeEnd.push(endDate)
+ endDate = moment(endDate).add(moment.duration(interval)).format('YYYY-MM-DDTHH:mm:ss[Z]')
}
const regex = new RegExp(/\d+/g)
const match = regex.exec(interval)
rangeInterval.push(match)
+ dateRangeEnd.push(endDate)
} else {
// Subdaily Layers
startDate = moment(start, dateTimeFormat).format('YYYY-MM-DDTHH:mm:ss[Z]')
diff --git a/web/js/modules/date/util.js b/web/js/modules/date/util.js
index e0534fb1b..78f97a030 100644
--- a/web/js/modules/date/util.js
+++ b/web/js/modules/date/util.js
@@ -363,20 +363,19 @@ export const coverageDateFormatter = (dateType, date, period) => {
break;
case 'yearly':
- if (dateType === 'END-DATE') parsedDate.setFullYear(parsedDate.getFullYear() - 1);
- dateString = moment(parsedDate).format('YYYY');
+ if (dateType === 'END-DATE') parsedDate.setFullYear(parsedDate.getFullYear());
+ dateString = moment.utc(parsedDate).format('YYYY');
break;
case 'monthly':
- if (dateType === 'END-DATE') parsedDate.setMonth(parsedDate.getMonth() - 1);
- dateString = moment(parsedDate).format('YYYY MMM').toUpperCase();
+ if (dateType === 'END-DATE') parsedDate.setMonth(parsedDate.getMonth());
+ dateString = moment.utc(parsedDate).format('YYYY MMM').toUpperCase();
break;
default:
dateString = formatDisplayDate(parsedDate);
break;
}
-
return (<MonospaceDate date={dateString} />);
};