Repository navigation
[Payment due @DylanDylann] Parse two-digit CSV years in the current century and reject years before 1900 - #103201
Conversation
|
@DylanDylann 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 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b35655d603
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
dylanexpensify
left a comment
There was a problem hiding this comment.
Looks good from a product perspective 👍
Reviewer Checklist
Screenshots/VideosUsed file: pr103201-two-digit-years.csv Screen.Recording.2026-10-08.at.16.39.16.movAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@marcochavezf 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] |
|
🎯 @DylanDylann, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
🚧 marcochavezf 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/marcochavezf in version: 9.5.6-0 🚀
|
|
No help site update needed. This is a bug fix: CSV dates with two-digit years (for example, |
|
Hi @NicolasBonet. Imported card expenses are not shown on the Spend tab, seems that's expected according to this comment bandicam.2026-10-09.10-46-13-951.mp4Did we miss something? Or need to use some preconditions? |
|
Thanks @IuliiaHerets! The expense not showing up is expected staging behaviour and isn't caused by this PR. On staging, company card scrapes import nothing for accounts that aren't To verify the fix, please try one of these:
Also, please write the amount as If neither option is possible, we can check the company card flow on production after deploy. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.6-6 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #103660 |
Explanation of Change
CSV dates with two-digit years were being imported as years 1-99. date-fns'
yyyytoken accepts 1-4 digits, so a value like9/22/26matchedMM/dd/yyyyas AD 26 and was normalized to0026-09-22.CompanyCards.tswrites that value back into the CSV row before upload. Auth then rejects it asMalformed created date: '00260922120000'and silently skips the row, while the import still reports success. The user never gets the expense.parseCSVDatenow:new Date()fallbacks (new Date('0026-09-22')also produces year 26).MM/dd/yy,dd/MM/yy,MM-dd-yy,dd-MM-yy,MMM d, yy,d MMM yy) after the four-digit ones. Theyyyyformats still match short years first, so these are reached only because those results are now rejected. date-fns'yytoken maps the year into the century closest to today, so26becomes 2026.A row whose date still can't be parsed now returns
null, andCompanyCards.tsalready skips such rows, so an implausible year no longer reaches the backend. The same parser is used by the expense CSV import (ImportTransactions.ts), which gets the same fix.A backstop check in the scraper is in https://github.com/Expensify/Server-Scraper/pull/4443.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/689145
PROPOSAL: N/A
Tests
npm test -- tests/unit/CSVDateUtils.test.ts tests/unit/ImportTransactionsand verify all tests pass.Card, Date, Merchant, Amount, Currencyand a row such asTest Card,9/22/26,Coffee,4.50,USD.22/09/26andSep 22, 26and verify both import as Sep 22, 2026.09/22/2026and verify it still imports as Sep 22, 2026.Offline tests
N/A. This only changes how dates are parsed from the CSV file before the upload request is made.
QA Steps
Card, Date, Merchant, Amount, Currencyand a row such asTest Card,9/22/26,Coffee,4.50,USD.09/22/2026and verify it still imports as Sep 22, 2026.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
Imported a CSV through Settings > Wallet > Import transactions (same
parseCSVDateas the company card CSV feed) with four rows dated9/22/26,22/09/26,Sep 22, 26and09/22/2026.Before: the import reports 4 transactions, but only the four-digit-year row shows up. The three short-year rows are silently dropped.
After: all 4 expenses are imported, and
9/22/26is dated 2026-09-22.