From dbbaec671774a30a93b723735fb5b6c46cd0e913 Mon Sep 17 00:00:00 2001 From: Adonis Puente <60629070+adonispuente@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:19:20 -0400 Subject: [PATCH] fix(lastSeen) update remaining filter data (#1839) --- src/api/api.js | 6 ++---- src/components/filters/useLastSeenFilter.js | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) 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/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 {