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

15 lines
599 B
TypeScript

import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
import type {PageFilters} from 'sentry/types';
import {getDateFilters} from 'sentry/views/starfish/utils/getDateFilters';
export const getDateConditions = (
selection: PageFilters
): {end?: string | undefined; start?: string | undefined; statsPeriod?: string} => {
const {startTime, endTime, statsPeriod} = getDateFilters(selection);
const {start, end} = normalizeDateTimeParams({
start: startTime.toDate(),
end: endTime.toDate(),
});
return statsPeriod ? {statsPeriod} : {start, end};
};