Skip to content

fix: updated dob check logic#15316

Merged
danieldoglas merged 2 commits into
Expensify:mainfrom
allroundexperts:fix-15228
Feb 24, 2023
Merged

fix: updated dob check logic#15316
danieldoglas merged 2 commits into
Expensify:mainfrom
allroundexperts:fix-15228

Conversation

@allroundexperts

@allroundexperts allroundexperts commented Feb 21, 2023

Copy link
Copy Markdown
Contributor

Details

Fixed Issues

$ #15228
PROPOSAL: #15228 (comment)

Tests

  1. Open Settings -> Profile -> Personal Details.
  2. Click on Date of birth.
  3. Choose date 17/2/2018.( Testing this scenario on 02/16)
  4. Press on save button.
  5. Error message will be display "Date should be before 2018-02-16."
  6. Now select 16/2/2018, it worked before but it shouldn't after this PR.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Open Settings -> Profile -> Personal Details.
  2. Click on Date of birth.
  3. Choose date 17/2/2018.( Testing this scenario on 02/16)
  4. Press on save button.
  5. Error message will be display "Date should be before 2018-02-16."
  6. Now select 16/2/2018, it worked before but it shouldn't after this PR.
  • 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
Screen.Recording.2023-02-21.at.2.47.53.PM.mov
Desktop
Screen.Recording.2023-02-21.at.2.48.49.PM.mov
iOS
Screen.Recording.2023-02-21.at.3.10.15.PM.mov
Android

android dob

@allroundexperts allroundexperts marked this pull request as ready for review February 21, 2023 10:13
@allroundexperts allroundexperts requested a review from a team as a code owner February 21, 2023 10:13
@melvin-bot melvin-bot Bot requested review from danieldoglas and rushatgabhane and removed request for a team February 21, 2023 10:13
@MelvinBot

Copy link
Copy Markdown
Contributor

@danieldoglas @rushatgabhane 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]

@danieldoglas danieldoglas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

changes LGTM, @rushatgabhane can you please test it and run the checklist?

@rushatgabhane rushatgabhane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web image
Mobile Web - Chrome image
Mobile Web - Safari image
Desktop image
iOS image
Android

WhatsApp Image 2023-02-24 at 02 55 27

@rushatgabhane

Copy link
Copy Markdown
Member

Bug: Date should be before 2018-02-23

image

@allroundexperts am i doing something wrong?

@rushatgabhane

rushatgabhane commented Feb 23, 2023

Copy link
Copy Markdown
Member

@danieldoglas should we change the meessage to

  • "You must be atleast 5 years old?"

  • "You must be less than 150 years old?"

@allroundexperts

allroundexperts commented Feb 23, 2023 via email

Copy link
Copy Markdown
Contributor Author

@rushatgabhane

Copy link
Copy Markdown
Member

@allroundexperts you're right, sorry i got confused.

@allroundexperts

Copy link
Copy Markdown
Contributor Author

@allroundexperts you're right, sorry i got confused.

No problem!

Glad that we sorted this!

@danieldoglas

Copy link
Copy Markdown
Contributor

@danieldoglas should we change the meessage to

we can change it but it's not part of the scope for this PR. We would also need to approve a copy of that.

@rushatgabhane rushatgabhane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@danieldoglas thanks for confirming. LGTM!

@danieldoglas danieldoglas merged commit 25b90c4 into Expensify:main Feb 24, 2023
@OSBotify

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
Open Search Page TTI 609.332 ms → 612.884 ms (+3.552 ms, +0.6%)
App start nativeLaunch 19.433 ms → 19.903 ms (+0.470 ms, +2.4%)
App start regularAppStart 0.014 ms → 0.014 ms (+0.000 ms, +3.4%)
App start TTI 717.467 ms → 714.805 ms (-2.662 ms, ±0.0%)
App start runJsBundle 204.344 ms → 196.844 ms (-7.500 ms, -3.7%)
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 609.332 ms
Stdev: 23.592 ms (3.9%)
Runs: 575.6345210000873 582.6263430002145 585.5355630000122 586.4732259998564 587.5562340000179 589.5231119999662 589.894491000101 590.4907230001409 590.6007080001291 592.8136390000582 597.3958340000827 597.7170009999536 597.9370120000094 598.1424149998929 598.4509280000348 600.6107179999817 601.1263440002222 603.5181480001193 606.585165000055 607.6694739998784 610.4241949999705 612.1784669999033 616.4286710000597 617.9029130002018 618.3328050000127 619.9519050000235 623.7264000000432 632.1733809998259 634.5238039998803 650.8353269998915 656.5030920000281 666.691487000091 667.978027000092

Current
Mean: 612.884 ms
Stdev: 27.404 ms (4.5%)
Runs: 569.3626709999517 576.2044679999817 581.4344480000436 581.6479090000503 583.8338220000733 584.7723800002132 584.9306240000296 586.4464109998662 594.0014249999076 594.1110439999029 594.373292000033 597.7451579999179 600.5145270000212 607.9608970000409 607.9686690000817 609.7347820000723 613.23490400007 614.7708329998422 615.1417650000658 615.6981609999202 617.6342370000202 618.3638919999357 622.8774830000475 622.9552009999752 624.8177089998499 628.3634850000963 632.3622650001198 634.0396730001085 637.9077560000587 652.7629400000442 657.5656749999616 675.8503819999751 685.7797850000206
App start nativeLaunch Baseline
Mean: 19.433 ms
Stdev: 1.726 ms (8.9%)
Runs: 17 18 18 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 19 20 20 21 21 21 21 22 22 22 25

Current
Mean: 19.903 ms
Stdev: 1.422 ms (7.1%)
Runs: 17 18 18 18 19 19 19 19 19 19 19 19 19 19 19 19 20 20 20 21 21 21 21 21 21 22 22 22 22 22 22
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (4.6%)
Runs: 0.012492000008933246 0.01273600000422448 0.012736000120639801 0.012816999922506511 0.01293900003656745 0.013061999925412238 0.013141999952495098 0.013142999960109591 0.013468999997712672 0.013590999995358288 0.013630999950692058 0.01367199991364032 0.013672000030055642 0.013712999993003905 0.013793999911285937 0.013794000027701259 0.013956999988295138 0.01395700010471046 0.01395700010471046 0.014078999985940754 0.014119999948889017 0.014159999904222786 0.014160000020638108 0.014322999981231987 0.014322999981231987 0.014322999981231987 0.014362999936565757 0.014526000013574958 0.014933999977074564 0.014974000165238976

Current
Mean: 0.014 ms
Stdev: 0.001 ms (7.4%)
Runs: 0.012776000192388892 0.012817000038921833 0.012818000046536326 0.01293900003656745 0.013142999960109591 0.013223999878391623 0.013386999955400825 0.013386999955400825 0.013508999953046441 0.013590999878942966 0.013713000109419227 0.01383400009945035 0.013875999953597784 0.013916000025346875 0.013916000025346875 0.013916000025346875 0.013916000025346875 0.014079000102356076 0.014119000174105167 0.014201000100001693 0.014241999946534634 0.014607999939471483 0.0148930000141263 0.014973999932408333 0.015137000009417534 0.015217999927699566 0.015257999999448657 0.015299000078812242 0.015299000078812242 0.015300000086426735 0.01603100006468594 0.017578000202775
App start TTI Baseline
Mean: 717.467 ms
Stdev: 32.378 ms (4.5%)
Runs: 641.3889010000275 655.8130739999469 677.17839799996 683.5879559998866 689.2934179999866 694.2120910000522 698.6330430000089 698.767920000013 699.4290539999492 701.1456190000754 702.2881259999704 704.8315250000451 706.4406360000139 710.4069939999608 710.5294689999428 711.2220029999735 712.4750490000006 715.3858699999982 716.6482240000041 716.8314580000006 717.7474239999428 729.0690829999512 731.7822209999431 735.5958970000502 738.220561999944 754.0964189999504 756.6480189999565 762.7399430000223 764.1024100000504 771.2465490000322 771.8398230000166 779.3427180000581

Current
Mean: 714.805 ms
Stdev: 24.673 ms (3.5%)
Runs: 667.9182410000358 679.3137280000374 679.4197970000096 680.755926999962 682.9466309999116 692.966604999965 693.1409050000366 694.8367530000396 695.1085560000502 698.6967660000082 699.1350410000887 709.4706820000429 711.3049300001003 711.5983219998889 713.8579239998944 718.4750250000507 718.4765959999058 718.7288039999548 721.1615710000042 721.6422709999606 726.800569999963 727.9957280000672 729.990099000046 731.2877819999121 734.0609480000567 735.8070300000254 736.4521780000068 746.2078909999691 751.876408000011 757.1799699999392 772.3440280000214
App start runJsBundle Baseline
Mean: 204.344 ms
Stdev: 24.534 ms (12.0%)
Runs: 164 171 175 177 182 183 186 188 188 188 192 197 198 198 199 199 200 201 201 204 206 208 209 215 216 222 226 228 231 260 263 264

Current
Mean: 196.844 ms
Stdev: 22.239 ms (11.3%)
Runs: 160 165 168 168 173 173 176 177 180 182 183 185 188 190 190 192 200 202 204 204 206 208 211 211 214 214 216 221 223 225 231 259

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/danieldoglas in version: 1.2.77-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/danieldoglas in version: 1.2.77-0 🚀

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

@OSBotify

OSBotify commented Mar 2, 2023

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.77-4 🚀

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

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