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

Allow future dates to be entered in DatePicker #13702

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

luacmartins
Copy link
Contributor

Details

Coming from this thread, our current Form guidelines state that the user should be able to enter whatever date they want and we should instead let validation handle any errors.

Fixed Issues

$ #13700

Tests

  1. Navigate to Workspace > Connect bank account > Connect manually
  2. Enter 011401533 and 1111222233331111 for routing and account number, respectively. Press Save & continue
  3. Enter a future date, e.g. 2033-01-01 in the Incorporation date input
  4. Select another input
  5. Verify that you see the Incorporation date cannot be in the future error
  6. Fill the form with correct data and press Save & continue
  7. In the Personal information, enter a future date for the Date of birth input
  8. Verify that you see the Must be over 18 years old error
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Same as test steps

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web

Screenshot 2022-12-19 at 1 01 23 PM

Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov

@luacmartins luacmartins self-assigned this Dec 19, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 19, 2022

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@luacmartins luacmartins marked this pull request as ready for review December 19, 2022 20:15
@luacmartins luacmartins requested a review from a team as a code owner December 19, 2022 20:15
@melvin-bot melvin-bot bot requested review from aimane-chnaif and Luke9389 and removed request for a team December 19, 2022 20:16
@melvin-bot
Copy link

melvin-bot bot commented Dec 19, 2022

@aimane-chnaif @Luke9389 One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Copy link
Contributor

@aimane-chnaif aimane-chnaif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as this issue occurs only on iOS, how about leaving it in other platforms?
I understand you made this for platforms consistency but limiting max date is a good feature.

@luacmartins
Copy link
Contributor Author

@aimane-chnaif as per this Slack thread our Form guidelines state that we should not limit user input and should instead let validation handle any errors. I think that leaving this prop for other platforms would only introduce inconsistencies and could potentially serve as an example to someone re-introducing this to iOS in the future.

I think it's best if we remove this altogether.

@aimane-chnaif
Copy link
Contributor

Found 2 issues while testing (not related to this PR)

  • console error
console.warning.mp4
  • picker modal flickers in android

bug

These can be handled in separate issues

@aimane-chnaif
Copy link
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
mchrome.mp4
Mobile Web - Safari
msafari.mp4
Desktop
desktop.mov
iOS
ios.mp4
Android
android.mp4

Copy link
Contributor

@aimane-chnaif aimane-chnaif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉 and tests well

@luacmartins
Copy link
Contributor Author

@aimane-chnaif I think those are unrelated to the changes in this PR. We can report them separately. Thanks for the review!

@luacmartins luacmartins merged commit 9a52f02 into main Dec 19, 2022
@luacmartins luacmartins deleted the cmartins-fixDatePicker branch December 19, 2022 23:10
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
TTI 802.736 ms → 803.474 ms (+0.737 ms, ±0.0%)
regularAppStart 0.017 ms → 0.015 ms (-0.002 ms, -11.5%)
nativeLaunch 9.226 ms → 9.032 ms (-0.194 ms, -2.1%)
runJsBundle 187.313 ms → 172.893 ms (-14.420 ms, -7.7%)
Show details
Name Duration
TTI Baseline
Mean: 802.736 ms
Stdev: 33.887 ms (4.2%)
Runs: 755.0492289997637 756.5526320002973 761.0719259995967 761.7189109995961 762.3624860001728 762.6288729999214 765.6285520000383 768.3180040000007 772.8005919996649 778.2822960000485 787.8456779997796 791.4781700000167 791.5235559996217 794.3971520001069 795.1970800003037 795.9854229995981 800.9329260000959 804.195782000199 812.6511559998617 817.5234369998798 817.9233860000968 819.0371230002493 824.156739000231 827.0680440003052 828.5289319995791 835.1698899995536 848.152715000324 858.4819959998131 860.0377230001613 861.657966000028 868.4679389996454

Current
Mean: 803.474 ms
Stdev: 41.788 ms (5.2%)
Runs: 738.6078239995986 752.2397579997778 759.8643770003691 760.4978210004047 762.0235280003399 763.4509500004351 768.8764319997281 769.7805660003796 777.2795569999143 777.3608710002154 782.3431190000847 784.9354240000248 785.4804720003158 795.2075249999762 797.4822850003839 798.9716550000012 799.343868999742 801.6534070000052 801.832162999548 805.3027179995552 806.3073249999434 824.9830849999562 828.9404840003699 831.100100999698 836.1866330001503 852.4177660001442 858.7519880002365 881.14100900013 894.1737050004303 907.6759860003367
regularAppStart Baseline
Mean: 0.017 ms
Stdev: 0.002 ms (13.1%)
Runs: 0.014566999860107899 0.014728999696671963 0.014851999469101429 0.014974000863730907 0.015096000395715237 0.015176999382674694 0.015217999927699566 0.015217999927699566 0.015259000472724438 0.015339999459683895 0.015341000631451607 0.015422000549733639 0.015461999922990799 0.015625 0.01582799945026636 0.015828999690711498 0.016073000617325306 0.016193999908864498 0.016315999440848827 0.016560999676585197 0.01672299951314926 0.017537999898195267 0.017862999811768532 0.017943999730050564 0.018025999888777733 0.018717999570071697 0.019084000028669834 0.020995999686419964 0.020995999686419964 0.021932000294327736 0.022542000748217106

Current
Mean: 0.015 ms
Stdev: 0.001 ms (8.7%)
Runs: 0.012695000506937504 0.012980000115931034 0.013143000192940235 0.013509000651538372 0.013590999878942966 0.013671999797224998 0.0139979999512434 0.014118999242782593 0.014119000174105167 0.014159999787807465 0.014200999401509762 0.014241000637412071 0.014322999864816666 0.014322999864816666 0.01444500032812357 0.014485999941825867 0.014688999392092228 0.014770999550819397 0.014932999387383461 0.015217999927699566 0.015258999541401863 0.015300000086426735 0.015381000004708767 0.015705999918282032 0.015828999690711498 0.01664300076663494 0.016723000444471836 0.01676500029861927 0.01708999928086996 0.01733400020748377 0.017780999653041363
nativeLaunch Baseline
Mean: 9.226 ms
Stdev: 1.313 ms (14.2%)
Runs: 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 11 11 11 11 12 12

Current
Mean: 9.032 ms
Stdev: 1.555 ms (17.2%)
Runs: 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 10 10 10 10 11 12 12 12 13
runJsBundle Baseline
Mean: 187.313 ms
Stdev: 23.457 ms (12.5%)
Runs: 155 160 161 162 164 164 164 164 166 167 168 172 173 177 178 179 183 190 193 193 196 197 201 201 210 211 211 219 219 225 232 239

Current
Mean: 172.893 ms
Stdev: 11.296 ms (6.5%)
Runs: 155 158 159 160 161 162 162 166 166 167 167 168 169 170 172 173 173 174 176 180 182 182 185 185 186 192 195 196

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @luacmartins in version: 1.2.42-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @yuwenmemon in version: 1.2.42-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@yuwenmemon
Copy link
Contributor

FYI as @mollfpr observed, this PR cause the issue here: #13837

Explanation: #13837 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants