Skip to content

Commit

Permalink
fix: custom map chart interaction for NASA statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
lubojr committed Apr 5, 2024
1 parent dcce8ac commit 9ef7f3f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/src/components/map/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -802,18 +802,20 @@ export default {
if (timeEntry === undefined && time.isLuxonDateTime) {
// search for closest time to datetime if provided as such
const searchTimes = this.availableTimeEntries.map((e) => {
if (e.value?.isLuxonDateTime) {
return e.value;
const timeValue = Array.isArray(e.value) ? e.value[0] : e.value;
if (timeValue?.isLuxonDateTime) {
return timeValue;
}
return DateTime.fromISO(e.value);
return DateTime.fromISO(timeValue);
});
const closestTime = findClosest(searchTimes, time);
// get back the original unmapped object with value and name
timeEntry = this.availableTimeEntries.find((e) => {
if (e.value?.isLuxonDateTime) {
return e.value.ts === closestTime.ts;
const timeValue = Array.isArray(e.value) ? e.value[0] : e.value;
if (timeValue?.isLuxonDateTime) {
return timeValue.ts === closestTime.ts;
}
return DateTime.fromISO(e.value).ts === closestTime.ts;
return DateTime.fromISO(timeValue).ts === closestTime.ts;
});
} else {
// Use most recent time since there is none defined in the map timeline
Expand Down

0 comments on commit 9ef7f3f

Please sign in to comment.