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-12-07] [$500] IOU - Cannot proceed to next month and dates appear blank when last day of month is selected #31793

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

Comments

@kbecciv
Copy link

kbecciv commented Nov 23, 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!


Version Number: 1.4.3.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: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Navigate to staging.new.expensify.com.
  2. Click FAB > Request money > Manual.
  3. Enter amount, choose participant and proceed to confirmation page.
  4. Click Show more > Date.
  5. Choose the date 31st Oct.
  6. Go to November.
  7. Choose the date 30th Sept.
  8. Go to October.

Expected Result:

In Step 6, user should be able to go to November.
In Step 8, no blank dates will be shown.

Actual Result:

In Step 6, user is unable to go to November.
In Step 8, blank dates are shown.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6288891_1700768927135.bandicam_2023-11-24_02-23-21-687.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cc0d157099a8bbaa
  • Upwork Job ID: 1727778969100070912
  • Last Price Increase: 2023-11-23
  • Automatic offers:
    • s77rt | Reviewer | 27845856
    • paultsimura | Contributor | 27845858
@kbecciv kbecciv 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 Nov 23, 2023
@melvin-bot melvin-bot bot changed the title IOU - Cannot proceed to next month and dates appear blank when last day of month is selected [$500] IOU - Cannot proceed to next month and dates appear blank when last day of month is selected Nov 23, 2023
Copy link

melvin-bot bot commented Nov 23, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01cc0d157099a8bbaa

Copy link

melvin-bot bot commented Nov 23, 2023

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

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

melvin-bot bot commented Nov 23, 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

Copy link

melvin-bot bot commented Nov 23, 2023

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

@paultsimura
Copy link
Contributor

paultsimura commented Nov 23, 2023

Proposal

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

What is the root cause of that problem?

The issue is that in the CalendarPicker, we check if there are available dates next month by the following logic:

const hasAvailableDatesNextMonth = startOfDay(endOfMonth(new Date(this.props.maxDate))) > addMonths(new Date(this.state.currentDateView), 1);
const hasAvailableDatesPrevMonth = startOfDay(new Date(this.props.minDate)) < endOfMonth(subMonths(new Date(this.state.currentDateView), 1));

Here, if the next month has <= days than the selected day number, we compare the start of the day with the end of the same day (end of next month):

disabled={!hasAvailableDatesNextMonth}

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

We should simplify this logic to avoid unnecessary chained calculations and only check if the max allowed date is after the end of the current month. This would mean that there are available dates next month – at least the props.maxDate will be available. We should also modify the navigation to the previous month in a similar way.

const hasAvailableDatesNextMonth = startOfDay(new Date(this.props.maxDate)) > endOfMonth(new Date(this.state.currentDateView));
const hasAvailableDatesPrevMonth = endOfDay(new Date(this.props.minDate)) < startOfMonth(new Date(this.state.currentDateView));

Also, we'll need to prevent the non-existing days from being falsely marked as "selected" when navigating, so we should also add a !!day (or even !isDisabled) check here:

const isSelected = !!day && isSameDay(parseISO(this.props.value), new Date(currentYearView, currentMonthView, day));

const currentDate = new Date(currentYearView, currentMonthView, day);
const isBeforeMinDate = currentDate < startOfDay(new Date(this.props.minDate));
const isAfterMaxDate = currentDate > startOfDay(new Date(this.props.maxDate));
const isDisabled = !day || isBeforeMinDate || isAfterMaxDate;
const isSelected = isSameDay(parseISO(this.props.value), new Date(currentYearView, currentMonthView, day));

Result:

Screen.Recording.2023-11-23.at.22.34.49.mov

What alternative solutions did you explore? (Optional)

@rakshitjain13
Copy link
Contributor

rakshitjain13 commented Nov 23, 2023

Proposal

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

Cannot proceed to next month and dates appear blank when the last day of the month is selected

What is the root cause of that problem?

Here will check for next month button should show or not, we are checking with the start time of the max date (last date of the current month) which cause the problem

const hasAvailableDatesNextMonth = startOfDay(endOfMonth(new Date(this.props.maxDate))) > addMonths(new Date(this.state.currentDateView), 1);

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

Here we should use the end of the day time instead of start time of max date

const hasAvailableDatesNextMonth = endOfDay(endOfMonth(new Date(this.props.maxDate))) > addMonths(new Date(this.state.currentDateView), 1);

What alternative solutions did you explore? (Optional)

NA

@s77rt
Copy link
Contributor

s77rt commented Nov 24, 2023

@paultsimura Thanks for the proposal. Your RCA is correct and the solution looks good to me 👍.

PS: When raising a PR please add test case in CalendarPickerTest.js to prevent this from happening again.

🎀 👀 🎀 C+ reviewed
Link to proposal

Copy link

melvin-bot bot commented Nov 24, 2023

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

@s77rt
Copy link
Contributor

s77rt commented Nov 24, 2023

@rakshitjain13 Thanks for the proposal. Your RCA is correct. The suggested solution would work but it's not complete i.e. it does not fix the wrongly selected days

Screenshot 2023-11-24 at 5 27 57 PM

@melvin-bot melvin-bot bot added the Overdue label Nov 27, 2023
@MonilBhavsar
Copy link
Contributor

Looks good. Agree we should simplify the logic

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

melvin-bot bot commented Nov 27, 2023

📣 @s77rt 🎉 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

Copy link

melvin-bot bot commented Nov 27, 2023

📣 @paultsimura 🎉 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 melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 28, 2023
@paultsimura
Copy link
Contributor

Thank you. The PR is ready for review: #32073

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 30, 2023
@melvin-bot melvin-bot bot changed the title [$500] IOU - Cannot proceed to next month and dates appear blank when last day of month is selected [HOLD for payment 2023-12-07] [$500] IOU - Cannot proceed to next month and dates appear blank when last day of month is selected Nov 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 30, 2023
Copy link

melvin-bot bot commented Nov 30, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Nov 30, 2023

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

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:

Copy link

melvin-bot bot commented Nov 30, 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:

  • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt] 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:
  • [@s77rt] 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:
  • [@s77rt] Determine if we should create a regression test for this bug.
  • [@s77rt] 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.
  • [@miljakljajic] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@s77rt
Copy link
Contributor

s77rt commented Nov 30, 2023

@miljakljajic
Copy link
Contributor

Both contracts paid and ended - thank you for your work!

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants