Repository navigation
Localize remaining display dates - #105846
roryabraham wants to merge 1 commit into
Conversation
|
@MelvinBot review |
|
@codex review |
Codex Review SummaryThis 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. |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@shubham1206agra 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c0021c3ef
ℹ️ 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".
|
|
||
| function formatUTCDateWithOptionalYear(datetime: string, dateFnsLocale: DateFnsLocale | undefined): string { | ||
| const date = toZonedTime(toDate(datetime, {timeZone: 'UTC'}), 'UTC'); | ||
| return formatDateWithOptionalYear(date, dateFnsLocale, toZonedTime(new Date(), 'UTC')); |
There was a problem hiding this comment.
Compare the optional year in the viewer's timezone
When the viewer's local calendar year differs from UTC around New Year's, comparing against toZonedTime(new Date(), 'UTC') adds or removes the year incorrectly. For example, at 2027-01-01 01:00 UTC a Los Angeles viewer is still in 2026, but a 2026-12-31 expense is rendered with 2026 even though it belongs to the viewer's current year. Use the viewer's current calendar year (or accept the selected timezone) while keeping the stored expense date itself fixed in UTC.
Useful? React with 👍 / 👎.
| if (!isValid(date)) { | ||
| return ''; | ||
| } | ||
| return isSameYear(date, now) ? formatDisplayDate(date, dateFnsLocale, MONTH_DAY_OPTIONS) : format(date, CONST.DATE.MONTH_DAY_YEAR_ABBR_FORMAT, {locale: dateFnsLocale ?? enUS}); |
There was a problem hiding this comment.
Same-year dates use Intl but other years use date-fns PP, so the style changes by locale. Checked on this branch (Nov 4 vs Nov 22, 2025): pt-BR 4 de nov. then 22 nov 2025, ja 11月4日 then 2025/11/22. Is that intended?
| } | ||
|
|
||
| /** The caller supplies now in the same timezone representation as date, so the year decision matches the visible day. */ | ||
| function formatDateWithOptionalYear(date: Date, dateFnsLocale: DateFnsLocale | undefined, now = new Date()): string { |
There was a problem hiding this comment.
SearchUIUtils still sizes the date column with doesDateBelongToAPastYear (device time), while this uses UTC isSameYear. On main both used the same function. Could they share one helper so they cannot drift?
| @@ -26,7 +26,7 @@ function PayOverdueInvoice({gracePeriodEndUnixSeconds, isOverdue = false}: PayOv | |||
| const icons = useMemoizedLazyExpensifyIcons(['InvoiceGeneric']); | |||
|
|
|||
| // formatWithUTCTimeZone needs ISO 8601. toUTCString (RFC 1123) would silently format as empty | |||
There was a problem hiding this comment.
Nit: this comment still names formatWithUTCTimeZone, which the next line no longer calls.
| @@ -80,15 +80,15 @@ function getBillingStatus({ | |||
| const endDate = ownerTravelBillingGracePeriodEnd ?? ownerBillingGracePeriodEnd; | |||
|
|
|||
| // formatWithUTCTimeZone parses ISO 8601, so an RFC 1123 string from toUTCString would silently format as empty | |||
There was a problem hiding this comment.
Same stale comment: it names formatWithUTCTimeZone, but the next line calls formatUTCDateForDisplay.
Port the test from Expensify#105846 that the per-diem e-receipt still separates the destination from the unchanged stored merchant dates after a language change.
Port the German and Japanese date picker label tests and the German Home prompt date test from Expensify#105846.
Parse the subscription end date with parseISO so the yyyy-MM-dd value is read as a local calendar day instead of UTC midnight, which showed the previous day in timezones behind UTC. Add the renewal date test from Expensify#105846.
formatToMonthDayWithOptionalYearInUTC shows the date in UTC, so read the date's year in UTC too before comparing it with the device's current year. Reading it in the device's timezone added a year to January 1 dates behind UTC. Add the DateCell, Last used and reused-route badge tests from Expensify#105846.
Port the booking confirmation date test from Expensify#105846, which renders the confirmation page in German and checks the day-first long date.
Port the test from Expensify#105846 that getTransactionDetails returns yyyy-MM-dd in German and Japanese, which the e-receipt now formats itself.
Port the status tooltip and status editor tests from Expensify#105846, which check the German and English dates and that saving keeps the machine clear-after value.
|
@roryabraham I created small PRs from the changes you made and I have in my stash for sometime. Please start reviewing them and close this PR as changes are overlapping. @linhvovan29546 See the draft PRs linked to the issue for review and you can do early review on all of them |
|
Ok, I'll close this in favor of smaller ones. |



Explanation of Change
Display dates now follow the language selected in the app, including date order, punctuation, and connecting words.
The shared formatters distinguish calendar dates from timestamps and dates already adjusted to a selected timezone. Expense dates stay on their original day, year labels agree with the displayed date, and annual renewal dates no longer move back a day in timezones behind UTC. Stored transaction dates, status expiry values, and the persisted per-diem merchant format remain unchanged.
Fixed Issues
$ #98088
Tests
000000if the local development app asks for a verification code.10in Amount.Locale date checkin Merchant.Dienstag, 3. November.Locale date checkexpense shows22. Jan.without a year.22. Jan.followed by the previous year, such as22. Jan. 2025.22 ene 2025.2025/01/22.Jan 22, 2025.Locale date checkin Message.02.12.2026 17:19.(du).Bis 02.12. 17:19, rather than12-02.Offline tests
Locale date checkexpense created above.2025/01/22.QA Steps
10in Amount.Locale date checkin Merchant.22. Jan.without a year.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
Not tested on this platform. Native Intl compatibility remains to be verified before this draft is marked ready.
Android: mWeb Chrome
Not tested on an Android device. The narrow-layout screenshot below is desktop Chromium with a phone-sized viewport, not an Android result.
iOS: Native
Not tested on this platform. Native Intl compatibility remains to be verified before this draft is marked ready.
iOS: mWeb Safari
Not tested on this platform.
MacOS: Chrome / Safari
Verified with Playwright Chromium on macOS. Safari was not tested. All evidence was captured before PR creation.
German Home and previous-year expense:
German current-year expense:
Japanese desktop and narrow layouts:
German status expiry and editor:
Read-only browser fixtures for annual renewal and booking confirmation. Backend requests were blocked while inspecting these fixtures, and the original client values were restored afterward. No paid plan update, payment, or booking was submitted.
Recorded fixed flow, including year inclusion, date selection, and Spanish/Japanese/English language changes:
fixed-flow-desktop.webm