Files
2024-02-15 17:01:50 +00:00

25 lines
624 B
TypeScript

import type {Location} from 'history';
import {decodeInteger} from 'sentry/utils/queryString';
export const ZOOM_START = 'startDuration';
export const ZOOM_END = 'endDuration';
export function decodeHistogramZoom(location: Location) {
let min: number | undefined = undefined;
let max: number | undefined = undefined;
if (ZOOM_START in location.query) {
min = decodeInteger(location.query[ZOOM_START], 0);
}
if (ZOOM_END in location.query) {
const decodedMax = decodeInteger(location.query[ZOOM_END]);
if (typeof decodedMax === 'number') {
max = decodedMax;
}
}
return {min, max};
}