Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

change date getTime to use more performant date now

Ed Plato1ce655966aac
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 67e48660e..b192094dc 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -866,7 +866,7 @@ class Timeline extends React.Component {
moveSelectedDateBackwards() {
const { selectedDate } = this.props;
const fortyMinutes = 40 * 60000;
- const now = new Date().getTime();
+ const now = Date.now();
const isRecent = Math.abs(now - selectedDate.getTime()) < fortyMinutes;
if (isRecent) {
this.onDateChange(now - fortyMinutes);
diff --git a/web/js/main.js b/web/js/main.js
index 751646942..7e2f1beb0 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -43,7 +43,7 @@ import { CUSTOM_PALETTE_TYPE_ARRAY } from './modules/palettes/constants';
const history = createBrowserHistory();
const configURI = Brand.url('config/wv.json');
-const startTime = new Date().getTime();
+const startTime = Date.now();
const compose = DEBUG === false || DEBUG === 'logger'
? defaultCompose
: DEBUG === 'devtools' && composeWithDevTools({
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index d0acb2155..900ca4cd8 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -68,7 +68,7 @@ export default function mapLayerBuilder(models, config, cache, ui, store) {
const getCacheOptions = (period, date, state) => {
const tenMin = 10 * 60000;
const thirtyMin = 30 * 60000;
- const now = new Date().getTime();
+ const now = Date.now();
const recentTime = Math.abs(now - date.getTime()) < thirtyMin;
if (period !== 'subdaily' || !recentTime) {
return {};
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 002cc1b67..2098a8839 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -95,7 +95,7 @@ export default (function(self) {
};
self.elapsed = function(message, startTime, parameters) {
if (parameters && !parameters.elapsed) return;
- const t = new Date().getTime() - startTime;
+ const t = Date.now() - startTime;
console.log(t, message);
return t;
};