Show year as well in date column#43413
Conversation
|
@dukenv0307 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] |
|
Adding images. |
|
Is there a clean way to do this where we only increase the date column width if we know we have dates from a prior year? cc @luacmartins |
|
Do we have to skip the year if it's from the ongoing year? |
|
CC: @JmillsExpensify |
|
Yea, that should be possible by comparing all dates we have and if any is from a previous year, we'd increase the column width. That being said, pagination could make the layout shift if a new expense from a previous year is returned |
|
@shawnborton Can you confirm if that is what we expect? |
|
We don't need to show the year if all expenses shown are from the current year. And if we don't show the year, then I like the idea of using the smaller column width to save space. Let me know if that makes sense! |
|
@shawnborton Just to confirm: What would happen when few expenses are from 2024 and few from 2023? Should we show 2024 in the expenses that belong to 2024 since the width is anyways going to be larger? |
|
We would have an increased column width, but the expenses from 2024 would not have the year in the column. This is how it works on OldDot, so I think we'd want to keep it the same for now. |
|
Lets use this thread to agree on the plan ahead. @ShridharGoel let us know if you have some issues with the proposed logic |
|
Waiting for @ShridharGoel's update |
|
Let me know when we have some updated screenshots to review! |
src/libs/SearchUtils.ts
Outdated
| // If the item is a ReportListItemType, iterate over its transactions and check them | ||
| return item.transactions.some((transaction) => { | ||
| const transactionYear = new Date(transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || '').getFullYear(); | ||
| return transactionYear !== new Date().getFullYear(); |
There was a problem hiding this comment.
we can define the currentYear = new Date().getFullYear() out of this block
src/libs/SearchUtils.ts
Outdated
| } | ||
|
|
||
| const createdYear = new Date(item?.modifiedCreated ? item.modifiedCreated : item?.created || '').getFullYear(); | ||
| return createdYear !== new Date().getFullYear(); |
|
It's done, though I'm not sure how it is feasible to use sortedData in this.
|
|
@dukenv0307 @ShridharGoel if anything is unclear please use the slack thread to discuss. Lets try to get this one merged today |
mountiny
left a comment
There was a problem hiding this comment.
changes look good to me now, I hope it wont be too slow in large list of transactions
| /** Whether we should show the tax column */ | ||
| shouldShowTax: boolean; | ||
|
|
||
| /** Info about whether there's atleast one transaction that doesn't belong to the present year */ |
There was a problem hiding this comment.
| /** Info about whether there's atleast one transaction that doesn't belong to the present year */ | |
| /** Info about whether there's at least one transaction that doesn't belong to the present year */ |
src/libs/TransactionUtils.ts
Outdated
| function getCreatedDate(transaction: OnyxEntry<Transaction>): string { | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| return transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; | ||
| } | ||
|
|
There was a problem hiding this comment.
NAB: Could we reuse it here
App/src/libs/TransactionUtils.ts
Line 467 in b12556b
There was a problem hiding this comment.
TBH I think we should rename getCreatedDate to getCreated and the current getCreated to getFormattedCreated, but that's a NAB
There was a problem hiding this comment.
@mountiny Isn't this already there in my changes? Can you check line 471 in this file?
src/components/Search.tsx
Outdated
|
|
||
| const isSortingAllowed = sortableSearchTabs.includes(query); | ||
|
|
||
| const doesAtleastOneExpenseBelongToAPastYear = SearchUtils.doesAtleastOneExpenseBelongToAPastYear(searchResults?.data); |
There was a problem hiding this comment.
| const doesAtleastOneExpenseBelongToAPastYear = SearchUtils.doesAtleastOneExpenseBelongToAPastYear(searchResults?.data); | |
| const shouldShowYear = SearchUtils.shouldShowYear(searchResults?.data); |
src/components/Search.tsx
Outdated
|
|
||
| const isSortingAllowed = sortableSearchTabs.includes(query); | ||
|
|
||
| const doesAtleastOneExpenseBelongToAPastYear = SearchUtils.doesAtleastOneExpenseBelongToAPastYear(searchResults?.data); |
src/libs/TransactionUtils.ts
Outdated
| function getCreatedDate(transaction: OnyxEntry<Transaction>): string { | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| return transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; | ||
| } | ||
|
|
src/libs/TransactionUtils.ts
Outdated
| function getCreatedDate(transaction: OnyxEntry<Transaction>): string { | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| return transaction?.modifiedCreated ? transaction.modifiedCreated : transaction?.created || ''; | ||
| } | ||
|
|
There was a problem hiding this comment.
TBH I think we should rename getCreatedDate to getCreated and the current getCreated to getFormattedCreated, but that's a NAB
|
We also have conflicts now |
|
@ShridharGoel we have lint and ts errors now |
|
code looks good now |
Reviewer Checklist
Screenshots/Videos |
|
@ShridharGoel Can you update the test steps please? |
Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com>
|
Updated. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.84-0 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.4.84-3 🚀
|






Details
Show year as well in date column.
Fixed Issues
$ #43209
PROPOSAL: #43209 (comment)
Tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop