Skip to content

Commit

Permalink
CustomTooltip: change link to measurements (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lanius-collaris authored Jan 6, 2024
1 parent f1d46ef commit 52d1dea
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions components/aggregation/mat/CustomTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,27 @@ export const generateSearchQuery = (data, query) => {
// use that value to limit date range on `/search` page
if ('measurement_start_day' in data) {
sinceFilter = data.measurement_start_day
const untilPlus1 = new Date(Date.parse(sinceFilter))
untilPlus1.setUTCDate(untilPlus1.getUTCDate() + 1)
untilFilter = untilPlus1.toISOString().split('T')[0]
const untilDateObj = new Date(Date.parse(sinceFilter))
switch(query.time_grain){
case 'hour':
untilDateObj.setUTCHours(untilDateObj.getUTCHours() + 1)
break
case 'week':
untilDateObj.setUTCDate(untilDateObj.getUTCDate() + 7)
break
case 'month':
untilDateObj.setUTCMonth(untilDateObj.getUTCMonth() + 1)
break
default:
untilDateObj.setUTCDate(untilDateObj.getUTCDate() + 1)
break
}
untilFilter = untilDateObj.toISOString()
if (query.time_grain !== 'hour') {
untilFilter = untilFilter.split('T')[0]
} else {
untilFilter = untilFilter.split('.')[0] + 'Z'
}
}

const queryObj = ['probe_cc', 'test_name', 'category_code', 'probe_asn', 'input', 'domain'].reduce((q, k) => {
Expand Down

1 comment on commit 52d1dea

@vercel
Copy link

@vercel vercel bot commented on 52d1dea Jan 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.