-
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 Date picker refactor PR#:21792] Selecting a valid date updates only the date and not the month #21123
Comments
Triggered auto assignment to @trjExpensify ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problemThe error message doesn't go away even after selecting a valid date in the date picker. What is the root cause of that problem?The root cause is that when we update the year, the following state gets updated: App/src/components/CalendarPicker/index.js Lines 70 to 78 in ffd9672
When the year changes, the selected date and month remain the same and only the year changes because the changes are not clamped. Whereas, on updating the ![]() What changes do you think we should make to solve this problem?Here is a possible list of alternatives: Option 1:Since the actual date selection is not being clamped, we can also forgo clamping the return {
selectedYear: newSelectedYear,
currentDateView: newMomentDate.toDate() // remove this.clampDate()
}; ResultScreen.Recording.2023-06-19.at.1.25.56.PM.movOption 2:We can update the return {
selectedYear: newSelectedYear,
currentDateView: this.clampDate(newMomentDate.toDate()),
selectedMonth: this.getNumberStringWithLeadingZero(newMomentDate.get('month') + 1), // Add this
}; Just like we do here:
ResultScreen.Recording.2023-06-19.at.1.27.42.PM.movOption 3:We can update the selected date as well an month to be clamped so if the date exceeds the allowable, it will automatically be set to the maximum date allowed. return {
selectedYear: newSelectedYear,
currentDateView: this.clampDate(newMomentDate.toDate()),
selectedMonth: this.getNumberStringWithLeadingZero(newMomentDate.get('month') + 1),
selectedDay: this.getNumberStringWithLeadingZero(newMomentDate.get('date')),
}; Just like we do here: App/src/components/CalendarPicker/index.js Lines 44 to 45 in ffd9672
ResultScreen.Recording.2023-06-19.at.1.43.04.PM.movPS I would recommend going with 1, but all options are equally viable. What other alternatives did you explore?Already broken down the solution into possible options. |
I can repro this, but before moving it on, do I recall you mentioning a refactor on this component @JmillsExpensify? Is this something to do with it? |
Hmm yeah oddly enough we are refactoring the year implementation in particular, not sure if this is related or not though. |
@trjExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Reached out to @ArekChr directly. If you want steps to test against your PR's branch, here they are:
Either way, we're actively refactoring this code, so this should wait until that PR has merged to avoid conflicts. I've popped it on hold for that PR. |
Hey, @trjExpensify, this test scenario works in my PR. I can add it to reproduce steps too. But I think it is not needed as now the year picked doesn't change the value from the input. |
Excellent! Okay, so I'll retest after that PR has deployed and then we'll be able to close this one out (and pay the bug report). |
Awaiting the linked PR before I retest this one. 👍 |
PR we're held on is in review. Dropping to weekly though for the hold. |
PR hit prod at the end of last week. Re-tested and this is fixed. @adeel0202 I've sent you an offer for the bug report, after which we can close this out. 👍 |
Accepted the offer, thanks. |
Paid! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
date
field but not the month (thus the error doesn't clear).Expected Result:
The selected month is updated and the error message is cleared upon entering a valid date.
Actual Result:
The selected month is not updated and the error message persists
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.29-6
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
Screen.Recording.2023-06-13.at.12.38.31.AM.mov
dob.mp4
Expensify/Expensify Issue URL:
Issue reported by: @adeel0202
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686600703269489
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: