diff --git a/src/api/api.js b/src/api/api.js index 1017c1e4f..5a0eeae55 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -196,10 +196,8 @@ export async function getEntities(items, { ...(options.filter && Object.keys(options.filter).length && generateFilter(options.filter)), ...(calculateSystemProfile(filters)), ...(fields && Object.keys(fields).length && generateFilter(fields, 'fields')), - ...filters?.lastSeenFilter?.updatedStart && - filters?.lastSeenFilter?.updatedStart.length > 0 && { updated_start: filters.lastSeenFilter.updatedStart }, - ...filters?.lastSeenFilter?.updatedEnd && - filters?.lastSeenFilter?.updatedEnd.length > 0 && { updated_end: filters.lastSeenFilter.updatedEnd } + ...filters?.lastSeenFilter?.updatedStart && { updated_start: filters.lastSeenFilter.updatedStart }, + ...filters?.lastSeenFilter?.updatedEnd && { updated_end: filters.lastSeenFilter.updatedEnd } } } ) diff --git a/src/components/InventoryTable/EntityTableToolbar.js b/src/components/InventoryTable/EntityTableToolbar.js index 67485a482..eca59613a 100644 --- a/src/components/InventoryTable/EntityTableToolbar.js +++ b/src/components/InventoryTable/EntityTableToolbar.js @@ -53,7 +53,7 @@ import useOperatingSystemFilter from '../filters/useOperatingSystemFilter'; import useFeatureFlag from '../../Utilities/useFeatureFlag'; import useGroupFilter from '../filters/useGroupFilter'; import { DatePicker, Split, SplitItem } from '@patternfly/react-core'; -import { fromValidator, toValidator } from '../filters/helpers'; +import { fromValidator, oldestDate, toValidator } from '../filters/helpers'; /** * Table toolbar used at top of inventory table. @@ -350,7 +350,7 @@ const EntityTableToolbar = ({ enabledFilters.updateMethodFilter && setUpdateMethodValue([]); enabledFilters.hostGroupFilter && setHostGroupValue([]); setEndDate(); - setStartDate(); + setStartDate(oldestDate); dispatch(setFilter([])); updateData({ page: 1, filters: [] }); }; diff --git a/src/components/filters/useLastSeenFilter.js b/src/components/filters/useLastSeenFilter.js index 42c18558c..fd0787a1f 100644 --- a/src/components/filters/useLastSeenFilter.js +++ b/src/components/filters/useLastSeenFilter.js @@ -60,7 +60,7 @@ export const useLastSeenFilter = ( setValue({ ...lastSeenValue, updatedStart: null, - updatedEnd: newApiEndDate + updatedEnd: `${newApiEndDate.format('YYYY-MM-DD')}T23:59:00.000Z` }); } else { setValue({ @@ -79,7 +79,7 @@ export const useLastSeenFilter = ( } else if (newApiStartDate > newApiEndDate || isNaN(newApiEndDate)) { setValue({ ...lastSeenValue, - updatedStart: newApiStartDate, + updatedStart: `${newApiStartDate.format('YYYY-MM-DD')}T00:00:00.000Z`, updatedEnd: null }); } else {