Repository navigation
Localize Search date range labels - #105878
Conversation
Build getFormattedDateRangeForSearch and the range in getFormattedQuarterForSearch with a cached Intl.DateTimeFormat range, so each language orders and joins the range its own way. The year shows in the same cases as before, engines without formatRange fall back to two joined dates, and an unreadable date gives an empty label.
A cached Intl.DateTimeFormat keeps the device timezone from when it was created. Format in UTC and copy the date's current local fields instead.
|
|
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@linhvovan29546 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@linhvovan29546 Can you test native devices for this PR? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4de148a6b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@MelvinBot Review |
|
🤖 Web test steps verification results: UI verification remains blocked by expense setup. Static source review separately validates an unguarded reversed-date range reaching
view run · no recording available |
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeiOS: mWeb SafariMacOS: Chrome / Safari |
roryabraham
left a comment
There was a problem hiding this comment.
Bummer that this one became a lot more complicated because we needed a polyfill for Hermes.
Upstream PRs for that are nearly 3 years old:
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.5.37-0 🚀
|
|
No help site update needed — this PR fixes localized date-range formatting without adding a workflow, renaming controls, removing a beta, or making any existing article sentence incorrect. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.37-1 🚀
Bundle Size Analysis (Sentry): |










Explanation of Change
Search date range labels (week groups, quarter groups, the date filter summary and comparison periods) were built by joining two hand-written
MMM ddates with-. That keeps the US order and repeats the month, so German showedSept. 1 - Sept. 7, 2025.getFormattedDateRangeForSearchand the range insidegetFormattedQuarterForSearchnow use a cachedIntl.DateTimeFormatand its range format, so each language orders and joins the range its own way, and writes a shared month or year once:The year is shown in exactly the same cases as before. English changes only in punctuation: the range uses an en dash with thin spaces, and a shared month is written once. The compact chart labels (
Sep 1 - 7, ’25) keep their styled short year and are not changed here.Hermes, which runs the app on iOS and Android, has no
Intl.DateTimeFormat.prototype.formatRange, and Hermes recommends a polyfill for it. This PR addsformatRangeon native from@formatjs/intl-datetimeformat, pinned to 6.12.6:DateTimeFormatkeeps formatting single dates, and formatjs formats the range from the same resolved options. Replacing the whole constructor would also mean shipping time zone data.IntlStore, like the other formatjs polyfills, and only when the polyfill is installed. The polyfill only installs whenformatRangeis missing, so it never runs on web and turns itself off once Hermes ships the method.@formatjs/ecma402-abstract2.0.0 with the formatjs packages we already use, so nothing is duplicated. formatjs 8 drops the month from Chinese ranges with a year (2026年620日 – 27日), and a unit test guards against upgrading to it.An unreadable date now gives an empty label instead of throwing.
This is one of a set of small, independent PRs that split up the date-localization work in #105846. They can merge in any order. Each one caches its own
Intl.DateTimeFormatnext to the function it changes; a follow-up will merge those into one shared helper.Fixed Issues
$ #98088
PROPOSAL:
Tests
Sep 1 – 7, 2025.Q1 2026 (Jan 1 – Mar 31).1.–7. Sept. 2025.Offline tests
Same as tests.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos