Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Properly offset days in year time and HH:MM hover labels

ZachTRice8d0a0ceee91c
diff --git a/web/js/date/config.js b/web/js/date/config.js
index f62e263ff..c68e15e71 100644
--- a/web/js/date/config.js
+++ b/web/js/date/config.js
@@ -607,8 +607,7 @@ export function timelineConfig(models, config, ui) {
return new Date(Date.UTC(first.getUTCFullYear(),
first.getUTCMonth(),
first.getUTCDate(),
- first.getUTCHours(),
- first.getUTCMinutes()));
+ first.getUTCHours()));
};
// Date of first printed normal tick
@@ -627,8 +626,7 @@ export function timelineConfig(models, config, ui) {
return new Date(Date.UTC(last.getUTCFullYear(),
last.getUTCMonth(),
last.getUTCDate(),
- last.getUTCHours(),
- last.getUTCMinutes() + 1));
+ last.getUTCHours() + 1));
};
// Value for hovered normal label
@@ -659,7 +657,6 @@ export function timelineConfig(models, config, ui) {
// Displayed default label
tl.zoom.current.ticks.boundary.label = function (d) {
- d = new Date(d.getTime() - (d.getTimezoneOffset() * 60000));
return util.pad(d.getUTCHours(), 2, '0') + ':' + util.pad(d.getUTCMinutes(), 2, '0');
};
diff --git a/web/js/date/timeline-ticks.js b/web/js/date/timeline-ticks.js
index 1b946a329..169cac4ce 100644
--- a/web/js/date/timeline-ticks.js
+++ b/web/js/date/timeline-ticks.js
@@ -387,7 +387,6 @@ export function timelineTicks(models, config, ui) {
var $boundaryTick;
var tick = this.parentNode;
var boundaryTick, boundaryTickWidth;
- var hoverDay = new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes());
// Using jquery to precise select as it's easier than d3
if (d3.select(tick)
@@ -428,7 +427,7 @@ export function timelineTicks(models, config, ui) {
' ' + d.getUTCDate() +
' ' + util.pad(d.getUTCHours(), 2, '0') +
':' + util.pad(d.getUTCMinutes(), 2, '0') +
- ' (' + util.daysInYear(hoverDay) + ')');
+ ' (' + util.daysInYear(d) + ')');
} else {
boundaryTick.append('svg:text')
.attr('class', 'hover-tick-label')
@@ -439,7 +438,7 @@ export function timelineTicks(models, config, ui) {
.text(d.getUTCFullYear() +
' ' + model.monthAbbr[d.getUTCMonth()] +
' ' + d.getUTCDate() +
- ' (' + util.daysInYear(hoverDay) + ')'); // Add hover Label
+ ' (' + util.daysInYear(d) + ')'); // Add hover Label
}
},
remove: function () { // TODO: update