Closed ds0001 closed 9 years ago
Appreciate the thought, but is there a specific reason you want to not allow for 4 digit years? You can easily prompt the user for this format (see the example page), in either case parsing the values turns out the same.
Sorry about the barrage of pull requests. The main reason to restrict to 2 digit years is for faster form input and feedback.
Right, I guess I'm saying that this is currently possible and you can indicate to the user this is possible (like on the example page), don't see the real value in the hard restriction.
Gotcha. Thanks for taking a look.
:+1:
update restrictExpiry method to accept an override value from an html element data attribute 'data-maxlength'. Nmp tests run green and I didn't see any specific tests on this method so I didn't bother with a new test.
Reason: I wanted to restrict it to 4 digits MMYY. The parseCardExpiry method allowed for 2 digits for year but the restrictExpiry method did not. I started with just using maxlength on the html input but felt it better to use a data attribute instead. Its possible the formatter could change from " / " to something else in which case the html input would have an incorrect maxlength attribute.