diff --git a/frontend/src/shared/modules/filters/config/apiFilterRenderer/date.filter.renderer.ts b/frontend/src/shared/modules/filters/config/apiFilterRenderer/date.filter.renderer.ts index d38b8ffca6..c7774d6129 100644 --- a/frontend/src/shared/modules/filters/config/apiFilterRenderer/date.filter.renderer.ts +++ b/frontend/src/shared/modules/filters/config/apiFilterRenderer/date.filter.renderer.ts @@ -42,7 +42,9 @@ export const dateApiFilterRenderer = (property: string, { value, operator }: Dat } else { let parsedValue = moment.utc(mappedValue).startOf('day').toISOString(); - if ([FilterDateOperator.GT].includes(operator)) { + if (['last24h'].includes(value as string)) { + parsedValue = mappedValue as string; + } else if ([FilterDateOperator.GT].includes(operator)) { parsedValue = moment.utc(mappedValue).endOf('day').toISOString(); } diff --git a/frontend/src/shared/modules/filters/config/constants/date.constants.ts b/frontend/src/shared/modules/filters/config/constants/date.constants.ts index da2a16f519..3eaffcdd22 100644 --- a/frontend/src/shared/modules/filters/config/constants/date.constants.ts +++ b/frontend/src/shared/modules/filters/config/constants/date.constants.ts @@ -39,10 +39,15 @@ export const dateFilterOperators: FilterOperator[] = [ ]; export const dateFilterTimePickerOptions: FilterTimeOptions[] = [ + { + value: 'last24h', + label: 'Last 24 hours', + getDate: () => moment().subtract(24, 'hour').toISOString(), + }, { value: 'last7days', label: 'Last 7 days', - getDate: () => moment().subtract(1, 'week').format('YYYY-MM-DD'), + getDate: () => moment().subtract(7, 'day').format('YYYY-MM-DD'), }, { value: 'last14days',