-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add missing violation data #54603
Conversation
src/libs/DateUtils.ts
Outdated
/** | ||
* Checks if the input time is after the reference date | ||
* param {Date} inputDate - The date to validate. | ||
* returns {boolean} - Returns true if the input date is after the reference date, otherwise false. | ||
*/ | ||
const isFutureDate = (inputDate: Date): boolean => { | ||
return isAfter(startOfDay(inputDate), startOfDay(new Date())); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove startOfDay
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In getDayValidationErrorKey we use startOfDay
so I think it would be more accurate and consistent to use it here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use isFutureDate
then because this would give incorrect results if you pass current date + few hours, it will be false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s77rt In my opinion:
- Currently, we don't have logics to select expense hour/minutes, only select date. We can consider this as time is not taken into account when checking for violations.
- The violation is ""Future date not allowed"", so it's best to compare dates only.
That's why I think comparing hours here is out of scope and should be addressed in another issue if we want to change current behavior.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not keep the function named isFutureDate
because its implementation is misleading. Let's do the following:
- Rename
isFutureDate
toisFutureDay
- Use that function in
getDayValidationErrorKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logics in getDayValidationErrorKey
and isFutureDay
returns false
for today and opposite value for other days, so using isFutureDay
inside getDayValidationErrorKey
will cause regressions on status clear after page:

In logics, we expect:
getDayValidationErrorKey
to return empty (false
) on future and today, error (true
) on pastisFutureDay
to returntrue
on future,false
on today and past
@daledah Please prioritize this and let me know when it's ready for review |
@s77rt I updated. Also, regarding #54603 (comment), tracking expenses (which uses Screen.Recording.2025-01-15.at.14.15.02.mov |
The amount comparison is not taking currency into account. Screen.Recording.2025-01-15.at.7.25.44.PM.mov |
Can you also check #54603 (comment) it seems to be unresolved yet |
Regarding #54603 (comment), because we don't have any logics to compare amounts with different currencies, I think it's out of scope and we should address it in another issue. |
Can you please resolve the conflicts |
This is still unresolved https://github.com/Expensify/App/pull/54603/files#r1920274495 |
In the test steps, specify that the workspace should be on Control plan. |
The receipt and amount errors are missing for a workspace that has currecny different than USD Screen.Recording.2025-01-20.at.11.39.38.AM.mov |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemweb-chrome.moviOS: Nativeios.moviOS: mWeb Safarimweb-safari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
@daledah Can you please prioritize this? |
@s77rt Sorry for the delay, I'll update soon. |
@s77rt I updated. |
@daledah We can keep the use of Also this comment is still not addressed #54603 (comment) |
✋ 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/carlosmiceli in version: 9.0.96-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.96-1 🚀
|
Explanation of Change
Fixed Issues
$ #54510
PROPOSAL: #54510 (comment)
Tests
Precondition: Control workspace
Steps:
Offline tests
Same as above
QA Steps
Precondition: Control workspace
Steps:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-12-27.at.12.37.14.mov
Android: mWeb Chrome
Screen.Recording.2024-12-27.at.12.38.46.mov
iOS: Native
Screen.Recording.2024-12-27.at.12.40.46.mov
iOS: mWeb Safari
Screen.Recording.2024-12-27.at.12.41.54.mov
MacOS: Chrome / Safari
Screen.Recording.2024-12-27.at.12.15.54.mov
MacOS: Desktop
Screen.Recording.2024-12-27.at.12.42.34.mov