diff --git a/flow-typed/search.js b/flow-typed/search.js index 2697bdd0a..6f6317a42 100644 --- a/flow-typed/search.js +++ b/flow-typed/search.js @@ -18,6 +18,12 @@ declare type SearchOptions = { SORT_ACCENDING: string, SORT_DESCENDING: string, EXACT: string, + TIME_FILTER: string, + TIME_FILTER_LAST_HOUR: string, + TIME_FILTER_TODAY: string, + TIME_FILTER_THIS_WEEK: string, + TIME_FILTER_THIS_MONTH: string, + TIME_FILTER_THIS_YEAR: string, }; declare type SearchState = { diff --git a/ui/constants/search.js b/ui/constants/search.js index 7251ba6ff..4a1f31253 100644 --- a/ui/constants/search.js +++ b/ui/constants/search.js @@ -25,4 +25,10 @@ export const SEARCH_OPTIONS = { SORT_ACCENDING: '^release_time', SORT_DESCENDING: 'release_time', EXACT: 'exact', + TIME_FILTER: 'time_filter', + TIME_FILTER_LAST_HOUR: 'lasthour', + TIME_FILTER_TODAY: 'today', + TIME_FILTER_THIS_WEEK: 'thisweek', + TIME_FILTER_THIS_MONTH: 'thismonth', + TIME_FILTER_THIS_YEAR: 'thisyear', }; diff --git a/ui/util/query-params.js b/ui/util/query-params.js index cbafd9ac1..bf4fa6bcc 100644 --- a/ui/util/query-params.js +++ b/ui/util/query-params.js @@ -71,6 +71,11 @@ export const getSearchQueryString = (query: string, options: any = {}) => { if (sortBy) { queryParams.push(`${SEARCH_OPTIONS.SORT}=${sortBy}`); } + + const timeFilter = options[SEARCH_OPTIONS.TIME_FILTER]; + if (timeFilter) { + queryParams.push(`${SEARCH_OPTIONS.TIME_FILTER}=${timeFilter}`); + } } const additionalOptions = {};