getDateConditions.tsx 594 B

1234567891011121314
  1. import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
  2. import {PageFilters} from 'sentry/types';
  3. import {getDateFilters} from 'sentry/views/starfish/utils/getDateFilters';
  4. export const getDateConditions = (
  5. selection: PageFilters
  6. ): {end?: string | undefined; start?: string | undefined; statsPeriod?: string} => {
  7. const {startTime, endTime, statsPeriod} = getDateFilters(selection);
  8. const {start, end} = normalizeDateTimeParams({
  9. start: startTime.toDate(),
  10. end: endTime.toDate(),
  11. });
  12. return statsPeriod ? {statsPeriod} : {start, end};
  13. };