@@ -42,13 +42,13 @@ import {
4242} from '@libs/SearchQueryUtils' ;
4343import { getDatePresets , getFeedOptions , getGroupByOptions , getStatusOptions , getTypeOptions } from '@libs/SearchUIUtils' ;
4444import CONST from '@src/CONST' ;
45+ import type { TranslationPaths } from '@src/languages/types' ;
4546import ONYXKEYS from '@src/ONYXKEYS' ;
4647import ROUTES from '@src/ROUTES' ;
4748import type { SearchAdvancedFiltersForm } from '@src/types/form' ;
4849import FILTER_KEYS from '@src/types/form/SearchAdvancedFiltersForm' ;
4950import type { CurrencyList } from '@src/types/onyx' ;
5051import { getEmptyObject } from '@src/types/utils/EmptyObject' ;
51- import type { TranslationPaths } from '@src/languages/types' ;
5252import type { SearchHeaderOptionValue } from './SearchPageHeader' ;
5353
5454type SearchFiltersBarProps = {
@@ -144,45 +144,49 @@ function SearchFiltersBar({queryJSON, headerButtonsOptions, isMobileSelectionMod
144144 } , [ filterFormValues . dateOn , filterFormValues . dateAfter , filterFormValues . dateBefore , translate ] ) ;
145145
146146 const createDateDisplayValue = useCallback (
147- ( filterValues : { on ?: string ; after ?: string ; before ?: string } ) : [ SearchDateValues , string [ ] ] => {
147+ ( filterValues : { on ?: string ; after ?: string ; before ?: string } ) : [ SearchDateValues , string [ ] ] => {
148148 const value : SearchDateValues = {
149149 [ CONST . SEARCH . DATE_MODIFIERS . ON ] : filterValues . on ,
150150 [ CONST . SEARCH . DATE_MODIFIERS . AFTER ] : filterValues . after ,
151151 [ CONST . SEARCH . DATE_MODIFIERS . BEFORE ] : filterValues . before ,
152152 } ;
153-
153+
154154 const displayText : string [ ] = [ ] ;
155155 if ( value . On ) {
156- displayText . push ( isSearchDatePreset ( value . On ) ? translate ( `search.filters.date.presets.${ value . On } ` ) : `${ translate ( 'common.on' ) } ${ DateUtils . formatToReadableString ( value . On ) } ` ) ;
156+ displayText . push (
157+ isSearchDatePreset ( value . On ) ? translate ( `search.filters.date.presets.${ value . On } ` ) : `${ translate ( 'common.on' ) } ${ DateUtils . formatToReadableString ( value . On ) } ` ,
158+ ) ;
157159 }
158160 if ( value . After ) {
159161 displayText . push ( `${ translate ( 'common.after' ) } ${ DateUtils . formatToReadableString ( value . After ) } ` ) ;
160162 }
161163 if ( value . Before ) {
162164 displayText . push ( `${ translate ( 'common.before' ) } ${ DateUtils . formatToReadableString ( value . Before ) } ` ) ;
163165 }
164-
166+
165167 return [ value , displayText ] ;
166168 } ,
167169 [ translate ] ,
168170 ) ;
169-
170- const [ posted , displayPosted ] = useMemo ( ( ) =>
171- createDateDisplayValue ( {
172- on : filterFormValues . postedOn ,
173- after : filterFormValues . postedAfter ,
174- before : filterFormValues . postedBefore ,
175- } ) ,
176- [ filterFormValues . postedOn , filterFormValues . postedAfter , filterFormValues . postedBefore , createDateDisplayValue ]
171+
172+ const [ posted , displayPosted ] = useMemo (
173+ ( ) =>
174+ createDateDisplayValue ( {
175+ on : filterFormValues . postedOn ,
176+ after : filterFormValues . postedAfter ,
177+ before : filterFormValues . postedBefore ,
178+ } ) ,
179+ [ filterFormValues . postedOn , filterFormValues . postedAfter , filterFormValues . postedBefore , createDateDisplayValue ] ,
177180 ) ;
178-
179- const [ withdrawn , displayWithdrawn ] = useMemo ( ( ) =>
180- createDateDisplayValue ( {
181- on : filterFormValues . withdrawnOn ,
182- after : filterFormValues . withdrawnAfter ,
183- before : filterFormValues . withdrawnBefore ,
184- } ) ,
185- [ filterFormValues . withdrawnOn , filterFormValues . withdrawnAfter , filterFormValues . withdrawnBefore , createDateDisplayValue ]
181+
182+ const [ withdrawn , displayWithdrawn ] = useMemo (
183+ ( ) =>
184+ createDateDisplayValue ( {
185+ on : filterFormValues . withdrawnOn ,
186+ after : filterFormValues . withdrawnAfter ,
187+ before : filterFormValues . withdrawnBefore ,
188+ } ) ,
189+ [ filterFormValues . withdrawnOn , filterFormValues . withdrawnAfter , filterFormValues . withdrawnBefore , createDateDisplayValue ] ,
186190 ) ;
187191
188192 const updateFilterForm = useCallback (
@@ -267,10 +271,10 @@ function SearchFiltersBar({queryJSON, headerButtonsOptions, isMobileSelectionMod
267271 [ `${ filterKey } After` ] : selectedDates [ CONST . SEARCH . DATE_MODIFIERS . AFTER ] ,
268272 [ `${ filterKey } Before` ] : selectedDates [ CONST . SEARCH . DATE_MODIFIERS . BEFORE ] ,
269273 } ;
270-
274+
271275 updateFilterForm ( dateFormValues ) ;
272276 } ;
273-
277+
274278 return (
275279 < DateSelectPopup
276280 label = { translate ( translationKey ) }
@@ -284,23 +288,12 @@ function SearchFiltersBar({queryJSON, headerButtonsOptions, isMobileSelectionMod
284288 } ,
285289 [ translate , updateFilterForm ] ,
286290 ) ;
287-
288- const postedPickerComponent = useMemo (
289- ( ) => createDatePickerComponent (
290- CONST . SEARCH . SYNTAX_FILTER_KEYS . POSTED ,
291- posted ,
292- 'search.filters.posted'
293- ) ,
294- [ createDatePickerComponent , posted ]
295- ) ;
296-
291+
292+ const postedPickerComponent = useMemo ( ( ) => createDatePickerComponent ( CONST . SEARCH . SYNTAX_FILTER_KEYS . POSTED , posted , 'search.filters.posted' ) , [ createDatePickerComponent , posted ] ) ;
293+
297294 const withdrawnPickerComponent = useMemo (
298- ( ) => createDatePickerComponent (
299- CONST . SEARCH . SYNTAX_FILTER_KEYS . WITHDRAWN ,
300- withdrawn ,
301- 'search.filters.withdrawn'
302- ) ,
303- [ createDatePickerComponent , withdrawn ]
295+ ( ) => createDatePickerComponent ( CONST . SEARCH . SYNTAX_FILTER_KEYS . WITHDRAWN , withdrawn , 'search.filters.withdrawn' ) ,
296+ [ createDatePickerComponent , withdrawn ] ,
304297 ) ;
305298
306299 const statusComponent = useCallback (
0 commit comments