From a57c79061ca8446a3fcdb02f18b89f51e3b9daf9 Mon Sep 17 00:00:00 2001 From: ssmucny Date: Sun, 23 Apr 2023 14:51:54 -0400 Subject: [PATCH] Add date range to event search page --- packages/frontend/src/pages/search.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/search.vue b/packages/frontend/src/pages/search.vue index ff33773319..b8ff55f15f 100644 --- a/packages/frontend/src/pages/search.vue +++ b/packages/frontend/src/pages/search.vue @@ -50,6 +50,14 @@ +
+ + + + + + +
{{ i18n.ts.search }} @@ -96,6 +104,8 @@ let eventSort = $ref('startDate'); let notePagination = $ref(); let userPagination = $ref(); let eventPagination = $ref(); +let startDate = $ref(null); +let endDate = $ref(null); const notesSearchAvailable = (($i == null && instance.policies.canSearchNotes) || ($i != null && $i.policies.canSearchNotes)); @@ -152,8 +162,10 @@ async function search() { endpoint: 'notes/events/search', limit: 10, params: { - query: searchQuery, + query: !searchQuery ? undefined : searchQuery, sortBy: eventSort, + sinceDate: startDate ? (new Date(startDate)).getTime() : undefined, + untilDate: endDate ? (new Date(endDate)).getTime() + 1000 * 3600 * 24 : undefined, }, };