getDateConditions.tsx 604 B

1234567891011121314
  1. import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
  2. import type {PageFilters} from 'sentry/types/core';
  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. };