You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-09-04] Expensify card-Validity dates briefly change to incorrect dates after changing the Limit type #99336
Version Number: v9.4.59-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/test-runs/70387627/folder/13176890/92190317/1686039163?sort=%2Bidentifier Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mav 26.5.1 Safari/Chrome, iPhone 13 iOS 26.6 App Component: Workspace Settings
Action Performed:
Precondition: Admin assigned a single-use card with the validity dates
Please re-state the problem that we are trying to solve in this issue.
Changing an Expensify Card's Limit type makes the validity dates of a single-use card briefly flicker to the wrong dates (typically off by one day) before snapping back to the correct values once the server responds.
What is the root cause of that problem?
The optimistic update writes the raw date-picker strings (yyyy-MM-dd) into the card's nameValuePairs.validFrom / validThru, but the RHP reads those fields as UTC datetimes. Reinterpreting a bare yyyy-MM-dd as UTC-midnight and projecting it into an assignee timezone behind UTC shifts the date back a day.
The RHP renders the range via getCardHintText, which assumes a UTC datetime, so the optimistic (plain-date) value renders as the previous calendar day for assignees behind UTC until the backend response replaces it.
Because the optimistic merge lands in the same WORKSPACE_CARDS_LIST collection the RHP reads, the wrong-format value is displayed until successData / the backend refresh replaces it with the properly normalized UTC datetime — producing the flicker. The shift only appears for assignees in timezones behind UTC, which is why it reads as a brief off-by-one.
What changes do you think we should make in order to solve the problem?
Make the optimistic data use the same normalized values already sent to the API, so the field format is consistent with what the display expects. In updateExpensifyCardLimitType, compute the normalized dates once and reuse them in both optimisticData and parameters:
and pass the same variables into parameters. This eliminates the format mismatch and the transient one-day shift.
What alternative solutions did you explore?
Alternatively, keep the optimistic value raw but make getCardHintText tolerate a bare yyyy-MM-dd (skip the UTC re-projection when there's no time component). This is riskier because the display helper is shared with the server-normalized values; unifying the optimistic write to the normalized format is the smaller, safer change.
Confidence: High — the code path is traced end-to-end and the format inconsistency is explicit in the same function.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99336) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
🤖 Draft PR created: #99647
Please mark it as "Ready for review" when it is ready for review.
What changed: Implemented the approved proposal. updateExpensifyCardLimitType in src/libs/actions/Card.ts now computes the normalized validity dates once and reuses them in both the optimistic Onyx update and the API parameters. Previously the optimistic write stored raw yyyy-MM-dd picker strings while the params sent UTC datetimes — the RHP renders that field as a UTC datetime, so the un-normalized optimistic value showed the previous calendar day for assignees behind UTC until the backend response replaced it (the flicker). Aligning the formats removes the transient off-by-one shift. The failure path is unaffected (it restores the previously stored, already-normalized values).
Checks:lint-changed ✅ and typecheck ✅ both pass. No existing unit test covers updateExpensifyCardLimitType.
App smoke test (web): pass — the app builds and the workspace/navigation area around the change renders cleanly. Note: the exact repro requires a precondition (admin-assigned single-use card with validity dates on an assignee behind UTC) that the test account doesn't have, so the limit-type flow itself couldn't be exercised end-to-end — that's left for QA/human testing per the PR's Tests/QA steps.
Step
Status
Observation
App loads to Home after sign-in
✅ pass
Home rendered with tabs and dashboard content
Settings > Workspaces renders without crash
✅ pass
Account has no workspaces; standard "No workspaces yet" empty state rendered, no error boundary
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Precondition: an admin has assigned a single-use Expensify Card with validity dates (validFrom / validThru) set, using an assignee account in a timezone behind UTC.
Go to Workspace > Expensify Card and open that card.
Click "Limit type" in the RHP, change the selection, and click Save.
Verify the validity dates shown on the card do not flicker/change to an incorrect (off-by-one) date at any point — they should stay stable through the optimistic update and the server response.
Activity
applause-bot commentedon Aug 24, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/2f91f3b8844c0caebce5f997a38760b2053e5be36ac3cb30f2c8551b089a848b
MelvinBot commentedon Aug 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Changing an Expensify Card's Limit type makes the validity dates of a single-use card briefly flicker to the wrong dates (typically off by one day) before snapping back to the correct values once the server responds.
What is the root cause of that problem?
The optimistic update writes the raw date-picker strings (
yyyy-MM-dd) into the card'snameValuePairs.validFrom/validThru, but the RHP reads those fields as UTC datetimes. Reinterpreting a bareyyyy-MM-ddas UTC-midnight and projecting it into an assignee timezone behind UTC shifts the date back a day.Inside
updateExpensifyCardLimitType, theoptimisticDataand the APIparametersare inconsistent:Card.ts:1143-1144Card.ts:1196-1197The RHP renders the range via
getCardHintText, which assumes a UTC datetime, so the optimistic (plain-date) value renders as the previous calendar day for assignees behind UTC until the backend response replaces it.Evidence chain
getCardHintText(card?.nameValuePairs?.validFrom, card?.nameValuePairs?.validThru, ...)—DynamicWorkspaceExpensifyCardDetailsPage.tsx:432getCardHintTextfeeds the fields toDateUtils.formatUTCDateTimeToDateInTimezone—CardUtils.ts:2099-2118toDate(utcDateTime, {timeZone: 'UTC'})— it treats the input as a UTC datetime —DateUtils.ts:1020-1031DynamicExpensifyCardLimitTypePage.tsx:109-121Because the optimistic merge lands in the same
WORKSPACE_CARDS_LISTcollection the RHP reads, the wrong-format value is displayed untilsuccessData/ the backend refresh replaces it with the properly normalized UTC datetime — producing the flicker. The shift only appears for assignees in timezones behind UTC, which is why it reads as a brief off-by-one.What changes do you think we should make in order to solve the problem?
Make the optimistic data use the same normalized values already sent to the API, so the field format is consistent with what the display expects. In
updateExpensifyCardLimitType, compute the normalized dates once and reuse them in bothoptimisticDataandparameters:Then in
optimisticData:and pass the same variables into
parameters. This eliminates the format mismatch and the transient one-day shift.What alternative solutions did you explore?
Alternatively, keep the optimistic value raw but make
getCardHintTexttolerate a bareyyyy-MM-dd(skip the UTC re-projection when there's no time component). This is riskier because the display helper is shared with the server-normalized values; unifying the optimistic write to the normalized format is the smaller, safer change.Confidence: High — the code path is traced end-to-end and the format inconsistency is explicit in the same function.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99336)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Aug 24, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cretadn22 (
External)melvin-bot commentedon Aug 24, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
cretadn22 commentedon Aug 27, 2026
@MelvinBot implement this
MelvinBot commentedon Aug 27, 2026
🤖 Draft PR created: #99647
Please mark it as "Ready for review" when it is ready for review.
What changed: Implemented the approved proposal.
updateExpensifyCardLimitTypeinsrc/libs/actions/Card.tsnow computes the normalized validity dates once and reuses them in both the optimistic Onyx update and the API parameters. Previously the optimistic write stored rawyyyy-MM-ddpicker strings while the params sent UTC datetimes — the RHP renders that field as a UTC datetime, so the un-normalized optimistic value showed the previous calendar day for assignees behind UTC until the backend response replaced it (the flicker). Aligning the formats removes the transient off-by-one shift. The failure path is unaffected (it restores the previously stored, already-normalized values).Diff
Checks:
lint-changed✅ andtypecheck✅ both pass. No existing unit test coversupdateExpensifyCardLimitType.App smoke test (web): pass — the app builds and the workspace/navigation area around the change renders cleanly. Note: the exact repro requires a precondition (admin-assigned single-use card with validity dates on an assignee behind UTC) that the test account doesn't have, so the limit-type flow itself couldn't be exercised end-to-end — that's left for QA/human testing per the PR's Tests/QA steps.
Evidence (2)
Home screen after sign-in
Workspaces list empty state
view run
melvin-bot commentedon Aug 27, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
9 remaining items
melvin-bot commentedon Aug 31, 2026
@cretadn22 Whoops! This issue is 2 days overdue. Let's get this updated quick!
cretadn22 commentedon Sep 2, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: [Single-use and Expire-by virtual cards]: update edit card flow #81783 (comment)
Link to the comment on the Issue: N/A
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/679851
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-5d70-aa97-6143-240dd9555a84melvin-bot commentedon Sep 3, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 3, 2026
Payment Summary
Resolving PRs:
Fix: Expensify Card validity dates flicker when changing Limit type #99647
Reviewer: @cretadn22 owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
cretadn22 commentedon Sep 8, 2026
@mallenexpensify friendly ping that this is due for payment. Thanks!
mallenexpensify commentedon Sep 8, 2026
Payment Summary
Contributor+: @cretadn22 due $250 via NewDot
JmillsExpensify commentedon Sep 9, 2026
$250 approved for @cretadn22