bendrucker / angular-credit-cards

Angular directives for parsing and validating credit card inputs
MIT License
328 stars 98 forks source link

cc-exp-year - entering "2018" gives a value of "202018" #135

Closed oodavid closed 7 years ago

oodavid commented 7 years ago

Using the following:

<input type="number" name="myCardExpYear" ng-model="newCard.exp_year" cc-exp-year ng-required="true" placeholder="YY">

It's possible to enter "2018" as the year, which yields a value of "202018"

bendrucker commented 7 years ago

The directive adds maxlength="2", how is it possible to enter 4 characters?

oodavid commented 7 years ago

Ahh, it's a mismatch - apparently maxlength doesn't apply when type="number" instead I guess we need min/max.

bendrucker commented 7 years ago

That's called out as not recommended in the docs: https://github.com/bendrucker/angular-credit-cards#cc-exp