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-01-25] Date inputs allow 5 to 6 digits as year in Manual journey of Connect Bank Account #13837

Closed
1 task
kavimuru opened this issue Dec 27, 2022 · 47 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Dec 27, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open the app
  2. Go to any workspace
  3. Choose Connect Bank Account
  4. Choose Connect manually
  5. Go to step 2 of the Form
  6. Enter random values of "Incorporation date" and you'll notice the year part of the value can go upto 6 digits

Expected Result:

Year value should only allow 4 digits

Actual Result:

User can enter upto 6 digits

Workaround:

unknown

Platforms:

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

  • MacOS / Chrome / Safari

Version Number: 1.2.43-1
Reproducible in staging?: y
Reproducible in production?: y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
image

Untitled

Expensify/Expensify Issue URL:
Issue reported by: @daraksha-dk
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1672076005803659

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a092ee76a867ed09
  • Upwork Job ID: 1613242559970676736
  • Last Price Increase: 2023-01-11
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 27, 2022
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Dec 27, 2022
@yuwenmemon
Copy link
Contributor

Oh yes, I've seen this one! Will take a look.

@melvin-bot melvin-bot bot added the Overdue label Jan 11, 2023
@yuwenmemon yuwenmemon self-assigned this Jan 11, 2023
@yuwenmemon yuwenmemon added the Internal Requires API changes or must be handled by Expensify staff label Jan 11, 2023
@melvin-bot melvin-bot bot unlocked this conversation Jan 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 11, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jan 11, 2023

Triggered auto assignment to Contributor Plus for review of internal employee PR - @mollfpr (Internal)

@yuwenmemon
Copy link
Contributor

Hmmm... I'm not sure what's happening here but it seems like we'd need a maxLength on our DatePicker component somewhere. Although I could be wrong.

Anyway, it's consistently reproducible and is purely front-end so will flip this External.

@melvin-bot melvin-bot bot removed the Overdue label Jan 12, 2023
@yuwenmemon yuwenmemon added External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors and removed Internal Requires API changes or must be handled by Expensify staff labels Jan 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 12, 2023

Current assignee @arielgreen is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jan 12, 2023

Current assignee @mollfpr is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jan 12, 2023

Current assignee @yuwenmemon is eligible for the External assigner, not assigning anyone new.

@yuwenmemon yuwenmemon added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Jan 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 12, 2023

Current assignee @arielgreen is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jan 12, 2023

Current assignee @mollfpr is eligible for the External assigner, not assigning anyone new.

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

melvin-bot bot commented Jan 12, 2023

Current assignee @yuwenmemon is eligible for the External assigner, not assigning anyone new.

@Pujan92
Copy link
Contributor

Pujan92 commented Jan 12, 2023

Proposal

It seems moment will allow the 6 digits for the year and it considers it as a valid, if we pass strict to true in moment constructor then 5/6 digits in the year will be considered invalid but still it can takes 6 digit internally to overwrite year in the input text.
We can provide a max date to the datepicker which will resolve this issue.

diff --git a/src/CONST.js b/src/CONST.js
index ef02585f6..277c4daac 100755
--- a/src/CONST.js
+++ b/src/CONST.js
@@ -41,6 +41,7 @@ const CONST = {
     DATE: {
         MOMENT_FORMAT_STRING: 'YYYY-MM-DD',
         UNIX_EPOCH: '1970-01-01 00:00:00.000',
+        MAX_DATE: '9999-12-31',
     },
     SMS: {
         DOMAIN: '@expensify.sms',
diff --git a/src/components/DatePicker/index.js b/src/components/DatePicker/index.js
index 2983ce762..29e2ee93c 100644
--- a/src/components/DatePicker/index.js
+++ b/src/components/DatePicker/index.js
@@ -30,6 +30,7 @@ class DatePicker extends React.Component {
     componentDidMount() {
         // Adds nice native datepicker on web/desktop. Not possible to set this through props
         this.inputRef.setAttribute('type', 'date');
+        this.inputRef.setAttribute('max', CONST.DATE.MAX_DATE);
         this.inputRef.classList.add('expensify-datepicker');
     }
Screen.Recording.2023-01-12.at.8.00.04.AM.mov

@yuwenmemon
Copy link
Contributor

Ah so simple! This makes sense to me. @mollfpr thoughts?

@fedirjh
Copy link
Contributor

fedirjh commented Jan 12, 2023

Proposal

we can pass the expected format parameter to moment when parsing the date, this will make asMoment.isValid validates the format too before trigger onInputChange

diff --git a/src/components/DatePicker/index.js b/src/components/DatePicker/index.js
index 2983ce7620..cd06957c4e 100644
--- a/src/components/DatePicker/index.js
+++ b/src/components/DatePicker/index.js
@@ -43,7 +43,7 @@ class DatePicker extends React.Component {
             return;
         }
 
-        const asMoment = moment(text);
+        const asMoment = moment(text, CONST.DATE.MOMENT_FORMAT_STRING);
         if (asMoment.isValid()) {
             this.props.onInputChange(asMoment.format(CONST.DATE.MOMENT_FORMAT_STRING));
         }

@tienifr
Copy link
Contributor

tienifr commented Jan 16, 2023

@arielgreen I think the split is fine. However I think the bonus for the timely PR should be split as well. Since any of the 3 could have been able to do the timely PR if he's chosen to implement the PR. And @Pujan92 already got the (2x) bigger original split for the added effort of implementing the PR.

If the bonus only goes to the one implementing the PR, then the original split should be equal (a.k.a 1/3 for each).

Just my 2 cents.

@Pujan92
Copy link
Contributor

Pujan92 commented Jan 16, 2023

Proposal

It seems moment will allow the 6 digits for the year and it considers it as a valid, if we pass strict to true in moment constructor then 5/6 digits in the year will be considered invalid but still it can takes 6 digit internally to overwrite year in the input text. We can provide a max date to the datepicker which will resolve this issue.

@tienifr just to point out I already mentioned your solution in my initial proposal with the drawback. Only thing I wasn't aware of the safari/firefox date support issue for which we would need to consider that as a partial solution. So I believe if your proposal differs and smoothly fixes the issue then definitely you get the job.
@yuwenmemon

@tienifr
Copy link
Contributor

tienifr commented Jan 16, 2023

@Pujan92 I interpret it as dismissing that solution, much like when I point out your proposal's potential issue here, rather than you proposing an alternate proposal (which should have accompanied code change and clear indication of such, ...). So I assume my proposal is the first one recommending that solution, which, along with your actual solution, goes into the final code change.

Anyway, let's leave the team to make the call here.

Thanks!

@arielgreen
Copy link
Contributor

I think the bonus for the timely PR should be split as well. Since any of the 3 could have been able to do the timely PR if he's chosen to implement the PR.

Thanks for your thoughts. Seems fair.

Offers sent to all.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jan 18, 2023
@melvin-bot melvin-bot bot changed the title Date inputs allow 5 to 6 digits as year in Manual journey of Connect Bank Account [HOLD for payment 2023-01-25] Date inputs allow 5 to 6 digits as year in Manual journey of Connect Bank Account Jan 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 18, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.55-0 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-01-25. 🎊

After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jan 18, 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:

@mallenexpensify mallenexpensify added Daily KSv2 and removed Reviewing Has a PR in review Weekly KSv2 labels Jan 20, 2023
@arielgreen
Copy link
Contributor

Not overdue, this is in its regression period.

@melvin-bot melvin-bot bot added the Overdue label Jan 23, 2023
@arielgreen
Copy link
Contributor

@mollfpr @yuwenmemon please be sure to complete the checklist here.

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jan 23, 2023

@arielgreen Thanks for the ping! Will finish the checklist today.

@yuwenmemon
Copy link
Contributor

Thanks @mollfpr - let me know if I can be of assistance.

@mollfpr
Copy link
Contributor

mollfpr commented Jan 25, 2023

Previously we have maximumDate props to DatePicker where it's set to new Date() on the CompanyStep form. But before this PR, the props are removed to allow users to input any future dates and the Form will validate the value.

Here's the PR #13702 that removes the maximumDate.

cc @yuwenmemon

@yuwenmemon
Copy link
Contributor

yuwenmemon commented Jan 25, 2023

@arielgreen last item in the checklist is all yours!

@mollfpr
Copy link
Contributor

mollfpr commented Jan 26, 2023

Bump @arielgreen

@melvin-bot melvin-bot bot added the Overdue label Jan 30, 2023
@arielgreen
Copy link
Contributor

All payments have been issued. Discussing a test here, then we can close this one out.

@melvin-bot melvin-bot bot removed the Overdue label Jan 31, 2023
@arielgreen
Copy link
Contributor

Bumped thread for consensus

@melvin-bot melvin-bot bot added the Overdue label Feb 6, 2023
@melvin-bot melvin-bot bot removed the Overdue label Feb 6, 2023
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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants