feat/81501: Add Range filter for all date type filters#81897
feat/81501: Add Range filter for all date type filters#81897neil-marcellini merged 91 commits intoExpensify:mainfrom
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [isSearchAdvancedFiltersFormLoading]); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
❌ PERF-10
Reasoning: Parent-child communication should not use useEffect. Instead, lift the state up to the parent component and pass it down as props. This follows React unidirectional data flow pattern, eliminates synchronization issues, reduces unnecessary renders, and makes the data flow clearer.
Suggested fix: Instead of calling onDateValuesChange in useEffect, call it directly when setDateValues is called in setDateValue:
const setDateValue = useCallback((dateModifier: SearchDateModifier, value: string | undefined) => {
setDateValues((prevDateValues) => {
const newDateValues = {...prevDateValues, [dateModifier]: value};
// Update parent immediately with new values
onDateValuesChange?.(newDateValues);
return newDateValues;
});
}, [onDateValuesChange]);Then remove the useEffect entirely.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
trjExpensify
left a comment
There was a problem hiding this comment.
Looks pretty good to me. CC: @Expensify/design @JmillsExpensify
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
Good to run a test build to check it out? |
|
Approval for Spanish translation commented on Slack: |
|
@btkcodedev We need to update the test steps now to consider the Custom date and Custom range option for the flow. |
What do you mean by this? I already see tests for date and range. |
neil-marcellini
left a comment
There was a problem hiding this comment.
Looking pretty good. There are still two changes I would like to see from my last review. We need to get translations verified and refactor into smaller components. The former change can be done in a follow up.
I was just referring to QA test steps in the PR description to update with Custom Date and Custom Range(as design updated) |
|
Done |
neil-marcellini
left a comment
There was a problem hiding this comment.
Thank you for the updates. It looks pretty good now. We can merge it after C+ does a final round of testing. @Pujan92 pls DM me when it's complete.
|
I found an issue but I think it can be taken in the follow-up. Issue - On the date filter after or before is applied, the respective date(+/-1) is auto-selected when you open the range picker. Some issue with the default selection value logic. Screen.Recording.2026-03-12.at.00.42.22.mov |
Cool, I agree. That's a fairly minor problem. |
|
🚧 @neil-marcellini has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.3.36-0 🚀
|
|
Deploy Blocker #84959 was identified to be related to this PR. |
|
Deploy Blocker #84987 was identified to be related to this PR. |
|
Deploy Blocker #84988 was identified to be related to this PR. |
|
Deploy Blocker #85027 was identified to be related to this PR. |
|
Deploy Blocker #85037 was identified to be related to this PR. |
|
Deploy Blocker #85051 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.36-10 🚀
|
Explanation of Change
Added a new Range date filter option with dual side-by-side calendars for easier date range selection across all search date filters (Date, Approved, Paid, Submitted, Withdrawn, Posted, Exported).
Key Improvements
New Range Mode: Users can now select date ranges using two calendars displayed side-by-side (desktop) or stacked (mobile/sidebar)
Two-Date Validation: Enforces that both From and To dates must be selected when using Range mode, preventing incomplete date ranges
Consistent Display: Date ranges are now displayed as "Range: Jan 1, 2024 - Jan 31, 2024" entries in filter lists and titles
Auto-Detection: When both After and Before dates exist on page load, it automatically switches to Range mode for better UX
Responsive Layouts:
Updated workflow: Custom Date and Custom Range are added for splitting one filter at a time
Technical Changes
CONST.SEARCH.DATE_MODIFIERS.RANGERangeDatePickercomponent with dual calendarsDateFilterBase,DatePresetFilterBase, andDateSelectPopupto support Range modeAdvancedSearchFiltersandSearchFiltersReportFieldPageDropdownButtonFixed Issues
$ #81501
PROPOSAL: #81501 (comment)
Tests
Test Steps
Range Mode - Desktop Popup
Range Mode - Sidebar Filters
Two-Date Validation
Individual After/Before Editing
Mobile/Narrow Layout
Offline tests
Same as above
QA Steps
Design verification
Verify that the designs are as given in the issue section
Range Mode - Desktop Popup
Range Mode - Sidebar Filters
Two-Date Validation
Individual After/Before Editing
Mobile/Narrow Layout
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen_Recording_20260209_234831_New.Expensify.Dev.mp4
Android: mWeb Chrome
Screen_Recording_20260209_234141_Brave.mp4
iOS: Native
Screen.Recording.2026-02-09.at.11.30.23.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-02-09.at.11.34.04.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-10.at.12.04.47.AM.mov