Skip to content
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 2023-10-23] [$500] Request money - On last day of month, going back to previous month disables forward button in request money date field #28622

Closed
6 tasks done
izarutskaya opened this issue Oct 2, 2023 · 30 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Oct 2, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

Precondition: It only happens when date is last day of month, if needed, same can be mimicked by changing device date

  1. Open the app
  2. Click on plus and click request money
  3. Click on manual, enter any amount and continue
  4. Select any user
  5. Click on show more and click date
  6. Click back arrow besides month and observe that now app disables next arrow making it impossible for user to get back to current month

Expected Result:

App should not disable next button of month if next month in value is current month

Actual Result:

App disables next button of month even if next month in value is current month in date field of request money on last day of month

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.75-8

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

Notes/Photos/Videos: Any additional supporting documentation

android.chrome.last.day.month.on.back.in.month.again.no.forward.mp4
windows.chrome.last.day.month.on.back.in.month.again.no.forward.mp4
mac.chrome.desktop.last.day.month.on.back.in.month.again.no.forward.mov
android.native.last.day.month.on.back.in.month.again.no.forward.mov
ios.safari.native.last.day.month.on.back.in.month.again.no.forward.mov
Recording.1684.mp4

Expensify/Expensify Issue URL:

Issue reported by: @dhanashree-sawant

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696091411087619

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01439bf07509667c9f
  • Upwork Job ID: 1708866759324012544
  • Last Price Increase: 2023-10-09
  • Automatic offers:
    • situchan | Reviewer | 27107395
    • c3024 | Contributor | 27107397
    • dhanashree-sawant | Reporter | 27107398
@c3024
Copy link
Contributor

c3024 commented Oct 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

For the last day of month after moving back to previous month, next arrow is disabled.

What is the root cause of that problem?

this.props.maxDate is present day and when the present day is last day of month, the moment(this.props.maxDate).endOf('month').startOf('day') is last of month 00:00. Say if the date is Sep 30, this value is Sep 30 00:00
and when we move to the previous month, this.state.currentView is the current date of previous month. In case of Sep 30, the previous month date is Aug 30 00:00 and adding 1 month gives Sep 30 00:00
and this here

const hasAvailableDatesNextMonth = moment(this.props.maxDate).endOf('month').startOf('day') > moment(this.state.currentDateView).add(1, 'months');

is false being both sides equal and next arrow is disabled.

What changes do you think we should make in order to solve the problem?

We should change the > to >=

const hasAvailableDatesNextMonth = moment(this.props.maxDate).endOf('month').startOf('day') >= moment(this.state.currentDateView).add(1, 'months');

What alternative solutions did you explore? (Optional)

Result
nextArrowEnabledForLastDateOfMonth.mov

@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 2, 2023
@melvin-bot melvin-bot bot changed the title Request money - On last day of month, going back to previous month disables forward button in request money date field [$500] Request money - On last day of month, going back to previous month disables forward button in request money date field Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01439bf07509667c9f

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)

@saranshbalyan-1234
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

While going back to the previous month from last day of the month, Arrow forward button is disabled in request money date field.

What is the root cause of that problem?

In the below code we check whether to disable Arrow forward button for next month or not.

const hasAvailableDatesNextMonth = moment(this.props.maxDate).endOf('month').startOf('day') > moment(this.state.currentDateView).add(1, 'months');

We have to check the end of day to include the complete month, but in the above code we are only considering the start of day, not the end

What changes do you think we should make in order to solve the problem?

We just need to check end of day instead of start of day to get the correct conditional result.

const hasAvailableDatesNextMonth = moment(this.props.maxDate).endOf('month').endOf('day') > moment(this.state.currentDateView).add(1, 'months');

What alternative solutions did you explore? (Optional)

N/A

@abzokhattab
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

If the user is on the last day of the month and then goes back to the previous month in the request money date field, it causes the forward button to become disabled.

What is the root cause of that problem?

The problem stems from the date comparison logic, which doesn't handle the last day of the month scenario properly in the following line:

const hasAvailableDatesNextMonth = moment(this.props.maxDate).endOf('month').startOf('day') > moment(this.state.currentDateView).add(1, 'months');

What changes do you think we should make in order to solve the problem?

To solve this problem, we should modify the calculation for hasAvailableDatesNextMonth to consider the start of the next month, as in our case the current date plus one month may be greater than the max date's month time.

const hasAvailableDatesNextMonth = moment(this.props.maxDate).endOf('month').startOf('day') > moment(this.state.currentDateView).add(1, 'months').startOf('month');

By adding .startOf('month') to the comparison, we are comparing the start of the next month with the start of the user's selected month, regardless of whether the current date is the last day of the month or not.

POC:

Screen.Recording.2023-09-30.at.8.48.25.PM.mov

@abzokhattab
Copy link
Contributor

Please notice that my proposal was the first proposal posted on Slack in this thread @situchan https://expensify.slack.com/archives/C049HHMV9SM/p1696096241828129?thread_ts=1696091411.087619&cid=C049HHMV9SM

Thanks

@melvin-bot melvin-bot bot added the Overdue label Oct 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

@anmurali, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@situchan
Copy link
Contributor

situchan commented Oct 9, 2023

Thanks for the proposals everyone.
I think we should assign @c3024 as they first proposed correct root cause and working solution. Changes for perfect condition will be done in PR.

@abzokhattab we don't allow posting proposals in slack unless bug reporter.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

Triggered auto assignment to @cristipaval, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

📣 @situchan 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

📣 @c3024 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Reviewing Has a PR in review and removed Daily KSv2 labels Oct 10, 2023
@melvin-bot melvin-bot bot added the Weekly KSv2 label Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-23] [$500] Request money - On last day of month, going back to previous month disables forward button in request money date field [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [$500] Request money - On last day of month, going back to previous month disables forward button in request money date field Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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 2023-10-23. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@situchan] A discussion in #expensify-bugs 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@anmurali] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 Daily KSv2 labels Oct 23, 2023
@cristipaval
Copy link
Contributor

@situchan could you please do the checklist?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 25, 2023
@cristipaval
Copy link
Contributor

friendly bump @situchan

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 30, 2023
@cristipaval
Copy link
Contributor

friendly bump @situchan

@situchan

@melvin-bot melvin-bot bot removed the Overdue label Nov 2, 2023
@situchan
Copy link
Contributor

situchan commented Nov 2, 2023

  • The PR that introduced the bug has been identified. Link to the PR: Feat: New Date Picker Design #15343
  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/15343/files#r1380256579
  • A discussion in #expensify-bugs 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
  • Determine if we should create a regression test for this bug.
  • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

This is edge case and not worth adding regression test.
Do you agree? 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Nov 6, 2023
@cristipaval
Copy link
Contributor

Thanks @situchan!

@melvin-bot melvin-bot bot removed the Overdue label Nov 6, 2023
@c3024
Copy link
Contributor

c3024 commented Nov 6, 2023

@anmurali

This is eligible for bonus. Could you complete the payment?

@melvin-bot melvin-bot bot added the Overdue label Nov 9, 2023
@cristipaval cristipaval changed the title [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [$500] Request money - On last day of month, going back to previous month disables forward button in request money date field [HOLD for payment 2023-10-23] [$500] Request money - On last day of month, going back to previous month disables forward button in request money date field Nov 9, 2023
@cristipaval
Copy link
Contributor

@anmurali, what's the payment status of this one?

@melvin-bot melvin-bot bot removed the Overdue label Nov 9, 2023
@situchan
Copy link
Contributor

Just to note that this is eligible for bonus. PR was C+ approved within bonus period and merged without any changes

@anmurali
Copy link

Paid with bonus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants