Closed kbecciv closed 7 months ago
Job added to Upwork: https://www.upwork.com/jobs/~01cc0d157099a8bbaa
Triggered auto assignment to @miljakljajic (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External
)
The issue is that in the CalendarPicker
, we check if there are available dates next month by the following logic:
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):
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));
https://github.com/Expensify/App/assets/12595293/50ca2707-a004-4ac5-9af2-a917f211d0db
Cannot proceed to next month and dates appear blank when the last day of the month is selected
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 https://github.com/Expensify/App/blob/7a68a3d1003130e63065bcbef253c912a3431c08/src/components/NewDatePicker/CalendarPicker/index.js#L130
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);
NA
@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
Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@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
Looks good. Agree we should simplify the logic
📣 @s77rt 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
📣 @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 📖
Thank you. The PR is ready for review: https://github.com/Expensify/App/pull/32073
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.5-7 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-12-07. :confetti_ball:
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.
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:
Both contracts paid and ended - thank you for your work!
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:
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?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/93399543/51509968-5a3d-4b65-a4b4-7ba2d4ca964f
View all open jobs on GitHub
Upwork Automation - Do Not Edit