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
✨ Support input masking four date formats #20383
Conversation
Fix date separators not appearing automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names lgtm as documented in slack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validator changes look good
@@ -46,6 +46,10 @@ tags: { | |||
"payment-card" # A named mask followed by | |||
"\\s" # a single whitespace | |||
"[^\\s]+)" # followed by one or more non-whitespace characters. | |||
"|([^\\s]+\\sdate-dd-mm-yyyy|date-dd-mm-yyyy\\s[^\\s]+)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe it's necessary to repeat the pre and post amble for whitespaces for each named mask. Instead these new ones could be put with payment-card
. Please verify with tests of course.
E.g.
"([^\\s]+" # One or more non-whitespace characters before
"\\s" # a single whitespace
"(?:" # non capturing group of one of the following:
"date-dd-mm-yyyy|" # a named mask or
"date-mm-dd-yyyy|" # a named mask or
"date-mm-yy|" # a named mask or
"date-yyyy-mm-dd|" # a named mask or
"payment-card" # a named mask
")" # end of non capturing group.
"|" # Or (to cover the other case):
"(?:" # non capturing group of one of the following:
"date-dd-mm-yyyy|" # a named mask or
"date-mm-dd-yyyy|" # a named mask or
"date-mm-yy|" # a named mask or
"date-yyyy-mm-dd|" # a named mask or
 "payment-card" # a named mask
")" # end of non capturing group. Followed by:
 "\\s" # a single whitespace
 "[^\\s]+)" # followed by one or more non-whitespace characters.
I also noticed this does not catch the attribute value of payment-card date-dd-mm-yy
. The single whitespace
should become \\s+ # one or more whitespaces, followed by
. Probably want to add a test case for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, this should help prevent mistakes when adding future named masks. I'll make this change in a followup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! To be clear on the case it did not catch, the example has two whitespaces between payment-card
and date-dd-mm-yyyy
.
* Support input masking four date formats Fix date separators not appearing automatically * Add missing dependency check config
This PR implements support for the following named masks to amp-inputmask:
Known Issues