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

card validate #130

Open
yingjun opened this issue Mar 13, 2014 · 1 comment
Open

card validate #130

yingjun opened this issue Mar 13, 2014 · 1 comment

Comments

@yingjun
Copy link

yingjun commented Mar 13, 2014

I filled all info, and expire date with 33/12.
card.isValid() return true.
it should return false.

@ssimmons42
Copy link

The function starting on line 1201 of skeuocard.js (ExpirationInputView.prototype._onKeyUp) takes the number you input and returns a date object. For some reason, if you use a month > 12 it will return a valid but incorrect date object. I made a workaround for this.

It was returning the date as long as month and year are not equal to zero. It was doing this by these lines:
dateObj = new Date(year, month - 1, day);
this.date = dateObj;

I changed it to return a date in the past if the month is > 12 like this:
if (month <=12) {
dateObj = new Date(year, month - 1, day);
} else {
dateObj = new Date(1900,1,1);
}
this.date = dateObj;

Since 1900 is in the past, Skeuocard recognized it as an invalid date.

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

No branches or pull requests

2 participants