Repository navigation
Show the picker's own AM/PM marker on time rows - #99170
Conversation
The row formatted the meridiem with date-fns' active locale while the picker labels it from common.am/common.pm, so German showed 12:00 vorm. above a picker offering AM/PM. Both now read the same translation key.
3d5836e to
799a157
Compare
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@chuckdries 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] |
|
well, created this PR per #98110 (comment). @blimpich can we have a dedicated issue for this?! thanks cc @aimane-chnaif |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safaritest1.movtest2.mov |
aimane-chnaif
left a comment
There was a problem hiding this comment.
I found inconsistency issue in other places:
Clear After row no longer matches the Status page or the "Until…" label
Repro:
- Settings → Profil → Status → Nach Ablauf löschen → Benutzerdefiniert.
- Tap Zeit, set 02:30 PM, save.
- Row under Zeit:
02:30 PM.
- Row under Zeit:
- Go back one screen to Status.
- Nach Ablauf löschen row:
2026-08-24 02:30 nachm.— different marker for the same value.
- Nach Ablauf löschen row:
In Greek this also surfaces the typo in el.ts:322 (pm: 'μμ.'), so the row reads μμ. where every other screen reads μ.μ..
The similar issue also happens on per-diem request confirmation page:
While these are existing inconsistencies in production, I think we can fix all of them in this PR.
| const {hour, minute, period} = get12HourTimeObjectFromDate(time12Hour); | ||
| return `${hour}:${minute} ${translate(period === CONST.TIME_PERIOD.AM ? 'common.am' : 'common.pm')}`; | ||
| } | ||
|
|
There was a problem hiding this comment.
Please also check this edge case:
DST spring-forward shifts the displayed time by an hour
getTime12HourWithTranslatedPeriod formats the time, then re-parses it via get12HourTimeObjectFromDate, which anchors the parse to today (DateUtils.ts:638).
On the local spring-forward day, a time inside the skipped hour normalizes forward.
Confirmed with the repo's date-fns:
TZ=America/New_York, ref = 2026-03-08
parse('02:30 AM','hh:mm a') -> Sun Mar 08 2026 03:30:00 GMT-0400
Repro step:
- Set the device date to March 7, 2026.
- Settings → Profile → Status → Clear after → select Custom.
- Tap Date → pick March 8, 2026. Tap Time → set 02:30 AM → Save.
- Set the device date to March 8, 2026, 00:30.
- Reopen Settings → Profile → Status → Clear after.
- Expected (and main): Time row reads 02:30 AM.
- With the PR: Time row reads 03:30 AM.
Production repro step:
Setup (do this on a day that is not the transition day):
- Set the device date to March 7, 2026.
- Settings → Profile → Status → Clear after → select Custom.
- Tap Date → pick March 8, 2026. Tap Time → enter 02:30, tap AM, tap Save.
- Back on Clear after, the Time row reads
02:30 AM. Tap Save.
Observe (on the transition day):
- Set the device date to March 8, 2026, 00:30 (before the 2 AM jump).
- Settings → Profile → Status → Clear after. The Time row still reads
02:30 AM— correct, this row is a plain format on production. - Tap the Time row.
- Bug: the picker opens pre-filled with
03:30 AM, not02:30 AM.
- Bug: the picker opens pre-filled with
- Tap Save without touching anything.
- The stored value becomes
2026-03-08 03:30:00: the Time row now reads03:30 AM, and the Status page summary reads2026-03-08 03:30 AM.
- The stored value becomes
The root cause exists in production and it's edge so we might not block on this?
|
|
@aimane-chnaif more cases and fixed them. you can find them in PR OP |
A time was formatted with date-fns under the app language while the picker that sets it labels its buttons from common.am/common.pm, so German read vorm. in one place and AM in another. Every render site now reads the same keys. The format/parse pair the picker round-trips through is untouched, and the marker is no longer derived by re-parsing a formatted string, which shifted an hour on the local DST change. Greek was also missing a dot on its PM marker.
b5bb08d to
bd818c0
Compare
|
I suspect German localization for am/pm is correct. I see on internet that Germans do not use "am" or "pm". Lines 319 to 320 in 1d0d7de |
yeah but we use am/pm in time picker. I think we need consistency: either am/pm or native vorm/nachm. I am curios what others think cc @blimpich @trjExpensify
|
| * returns {string} example: 11:10 PM | ||
| */ | ||
| function formatTimeWithPeriod(translate: LocalizedTranslate, date: Date, timeFormat: string = CONST.DATE.LOCAL_TIME_FORMAT_WITHOUT_PERIOD): string { | ||
| return `${format(date, timeFormat)} ${getTimePeriodLabel(translate, date.getHours())}`; |
There was a problem hiding this comment.
Worth noting:
| locale | formatLong.time |
format(d,'p') |
format(d,'h:mm a') |
|---|---|---|---|
| zh-hans | zzzz a h:mm:ss |
下午 2:30 |
2:30 下午 |
| el | h:mm:ss a zzzz |
2:30 μ.μ. |
2:30 μ.μ. |
| ja | H時mm分ss秒 zzzz |
14:30 |
2:30 午後 |
| de / en / es / fr / it / nl / pl / pt-BR | HH:mm:ss zzzz |
14:30 |
2:30 PM |
Chinese (zh-Hans) is marker-first — 下午 2:30. Japanese is interesting too: CLDR treats ja as 24-hour, so its localized time format has no meridiem at all.
Does date-fns support that already? Only through the localized-format tokens — p, pp, ppp, pppp (and P, Pp, PPpp), which read locale.formatLong.time and therefore honor both the ordering and the 12-vs-24-hour convention. The plain tokens are strictly positional: format(d, 'h:mm a') emits time-then-marker in every locale, because you wrote the pattern that way.
The app uses p nowhere — zero occurrences across src/. CONST.DATE.LOCAL_TIME_FORMAT has always been the hardcoded 'h:mm a', so main and this PR produce identical ordering. Not a regression.
So for zh-Hans the app shows 2:30 下午 where native convention is 下午2:30 — a pre-existing i18n gap, unchanged by the PR, and now easier to fix in one place than it was before.
There was a problem hiding this comment.
@aimane-chnaif I think this is NAB? I am supposing not to touch formats further. what do you think?
There was a problem hiding this comment.
yup I didn't say this is blocker but just worth noting.
|
Just awaiting product feedback on #99170 (comment) |
@JmillsExpensify as the product person on this PR, do you have a take? |
|
Sorry for the delay! I think we just go with the straight literal translation: orm/nachm. This is more of a localization consideration that isn't supported and we don't need to block on it. A lot of Europe uses 24 time, and we can consider adding that separately. |
|
🚧 blimpich has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/blimpich in version: 9.4.63-0 🚀
|
Help site review — no changes requiredI reviewed the changes in this PR and no help site updates are needed under Why: This is an internal localization/formatting bug fix. It makes the AM/PM (meridiem) marker shown on time rows read from the same translation keys as the The help articles that mention the affected surfaces (Per Diem, Custom Status, Travel, Scheduled Calls) document how to use those features — none of them document how the AM/PM marker is rendered per locale, which is the only thing this PR changes. There is no user-facing workflow, feature name, button, or setting change to reflect. Since the fix simply brings mismatched locales into line with the behavior the rest of the app already had, there's nothing to add or correct. No draft PR was created since no documentation changes are warranted. @mukhrr, if you believe a specific article should still be updated, let me know which surface and I'll draft it. |
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.63-1 🚀
Bundle Size Analysis (Sentry): |

Explanation of Change
A displayed time and the
TimePickerthat sets it took the AM/PM marker from two different sources. Renders useddate-fnsunder the app language, the picker labels its buttons fromcommon.am/common.pm. Only de (vorm./nachm.) and el (π.μ./μ.μ.) ever disagreed, every other locale already matches its keys.Every render site now reads the same two keys, through
DateUtils.getTimePeriodLabeland the two formatters built on it.Bugs this closes
vorm./nachm.above a picker offeringAM/PMBis …status label disagreed with bothGestern um 8:51 nachm.) disagreed with everything elseμμ.where every other screen readμ.μ.Everywhere else the marker renders, swept in the same pass so the mismatch cannot come back on a screen nobody listed:
ParticipantLocalTimeAutoUpdateTime→ProfilePageChronosOOOListActionsformatTravelDate→getTravelUpdateMessagegetFormattedTransportDate/getFormattedTransportDateAndHourgetFormattedCancellationDateScheduleCallPage,ScheduleCallConfirmationPageOnboardingHelpDropdownButtonextractTime12Houris unchanged and is now picker-internal only.TimePickerstill formats with it and parses the result back withget12HourTimeObjectFromDateunder the same default locale, which is what #98110 relies on to save a German Per Diem. The other parse sites (combineDateAndTime, the chart's serverAs offormats) are untouched, so nothing that reads a string back changes.The
As of:label on chart cards is deliberately left alone.VictoryChartLabelis bundled into the standaloneserver/victory-chart-rendererbinary against react-native stubs, and reaching the locale context from there pullsasyncOpenURLand itsLinkingimport into a bundle that has no such export. That label's sentence is server-generated English anyway.Timezone-aware surfaces take the marker from the hour in that timezone, not the reader's, so a call slot or a cancellation deadline cannot flip AM/PM across a timezone boundary.
CONST.DATE.LOCAL_TIME_FORMAT_WITHOUT_PERIODandTIME_FORMAT_WITHOUT_PERIODare added toMACHINE_DATE_CONSTANTSinrequire-locale-for-localized-date-format, since they carry no language-dependent token and the rule treats every otherCONST.DATEformat as localized by default.Fixed Issues
$ #99345
PROPOSAL:
Tests
hh:mm AM/hh:mm PM, notvorm./nachm., and matches the picker it opens(Bis …)label readsAM/PMGestern um 8:51 PM, not8:51 nachm.μ.μ.(it previously readμμ.) and that times elsewhere read the same午前/午後Offline tests
Same as tests. Every one of these renders from a local value with a static translation, so nothing changes offline.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop