-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[HOLD for payment 2024-05-06] [$250] Can't update the custom time of the status to 00:59 #40495
Comments
Triggered auto assignment to @garrettmknight ( |
@garrettmknight I investigated this bug while discovering it. Could I take over this one as C+ role? |
ProposalPlease re-state the problem that we are trying to solve in this issue.The bug occurs not just for 00:59, it occurs for every time less than 1 hour. We cannot save the time What is the root cause of that problem?The bug occurs because the condition hour === 0 in the original code only checks if the hour part of the time is exactly 0. However, it doesn't consider the minutes part of the time. As a result, the condition hour === 0 allows times like 00:59 to pass through, even though they are less than one minute in the future. We call validate below: App/src/components/TimePicker/TimePicker.tsx Lines 130 to 135 in 9033ccb
Which calls the below util: Line 664 in 9033ccb
And we return false if hour is 0: Lines 672 to 674 in 9033ccb
What changes do you think we should make in order to solve the problem?To fix this bug, we need to adjust the condition to also consider the minutes part of the time. By checking if both the hour is 0 and the minutes are less than or equal to 59, we ensure that times like 00:59 are properly detected as less than one minute in the future. We need to add a const isTimeAtLeastOneMinuteInFuture = ({ timeString, dateTimeString }: { timeString?: string; dateTimeString: string }): boolean => {
let dateToCheck = dateTimeString;
if (timeString) {
const [hourStr, minuteStr] = timeString.split(/[:\s]+/);
const hour = parseInt(hourStr, 10);
const minute = parseInt(minuteStr, 10);
// Check if time is 00:00
if (hour === 0 && minute === 0) {
return false;
}
dateToCheck = combineDateAndTime(timeString, dateTimeString);
}
const now = new Date();
return isAfter(new Date(dateToCheck), addMinutes(now, 1));
}; What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Can't update the custom time of the status to 00:59 What is the root cause of that problem?There are two issue we need to handle here:
What changes do you think we should make in order to solve the problem?We need to first remove the } else if (updatedTime.includes(':')) {
// it's in "hh:mm a" format
const [time, ampm] = updatedTime.split(' ');
const [hours, minutes] = time.split(':');
let hour = parseInt(hours, 10);
if (ampm === 'PM' && hour !== 12) {
hour += 12;
} else if (ampm === 'AM' && hour === 12) {
hour = 0;
}
const tempTime = parse(`${hour}:${minutes}`, 'HH:mm', new Date());
if (isValid(tempTime)) {
parsedTime = tempTime;
}
} What alternative solutions did you explore? (Optional) |
PLEASE PRIORITIZING YOUR PR BEFORE POSTING NEW PROPOSAL |
ProposalPlease re-state the problem that we are trying to solve in this issue.Error: Please choose a time at least one minute ahead What is the root cause of that problem?We have 2 problems:
Lines 672 to 674 in 68e6962
What changes do you think we should make in order to solve the problem?First we need to create new field in
In TimePicker Component we should introduce new state called Then we need to update App/src/components/TimePicker/TimePicker.tsx Line 130 in 64695c8
Finally, we update the message field here to use new state App/src/components/TimePicker/TimePicker.tsx Line 524 in 64695c8
Optional: We also should remove this condition because it is redundant Lines 672 to 674 in 9033ccb
What alternative solutions did you explore? (Optional)NA |
ProposalPlease re-state the problem that we are trying to solve in this issue.Custom time of the status can't be set to any value with hour as 00. What is the root cause of that problem?We can add a new state errorMessage and update it via handleSubmit
Code can be polished. Psuedo code for FormHelpMessage
Same change will be needed in Lines 709 to 715 in 9a115b6
What alternate solutions did you explore?Below suggestions are from my original proposal, which have been moved to this section because design team mentioned that we only need to update the message. Option 1: We shouldn't be allowing the user to type 00. As of now, when user types 14, it gets changed to 02 with PM. Same for other numbers > 12. Likewise, when user types 00, it should be changed to 12 AM. App/src/components/TimePicker/TimePicker.tsx Lines 221 to 227 in 305f12c
In the above, add the below condition:
(Option 1 isn't good because when the user would delete the value for entering a new one, it will start showing 12 instead of 00) Option 2: When the user saves, we can change '00' in hours to '12', update to AM and then continue. Update the handleSubmit method in TimePicker.
Code can be polished. Video for the above option 2TimeChange.mov |
@shawnborton @dannymcclain Any thoughts on the flow shown in the video above? |
Given that we are clearly using AM/PM here, I would think we'd just throw an error saying that you can't enter "00" for the hour. |
So I think we just need a better error message. |
Job added to Upwork: https://www.upwork.com/jobs/~0187eaa0221ed74ecf |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel ( |
📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Triggered auto assignment to @shmaxey ( |
@DylanDylann added you for C+ after the external label. Please review the proposals - to @shawnborton's point, I think we'll need a better error message like: @shmaxey what do you think? |
Proposal |
Triggered auto assignment to @arosiclair, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Why do you think it is important |
@ShridharGoel there's no RCA in your proposal. @nkdengineer's proposal LGTM |
📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@DylanDylann we have open PR here |
@garrettmknight I can ask in |
Thanks! Here's the english copy from @shmaxey
|
Ah okay missed that thanks. Reviewing the Spanish copy here |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.67-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-05-06. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
All paid out - @DylanDylann can you complete the checklist when you get a chance? |
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed: [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: #24620 Regression Test Proposal
Do we agree 👍 or 👎 |
All set |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.63-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @DylanDylann
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1713463886729749
Action Performed:
Expected Result:
We should update successfully
Actual Result:
Error: Please choose a time at least one minute ahead
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Recording.2987.mp4
Screen.Recording.2024-04-19.at.00.31.22.mov
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: