Skip to content

Commit

Permalink
Fixing logic to check for any input rather than a month / day. Also c…
Browse files Browse the repository at this point in the history
…leaned up with latest lint tests and verified it passed unit existing tests.
  • Loading branch information
manifestinteractive committed Jun 19, 2015
1 parent 5c19930 commit 8bfb401
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var React = require('react');
var classNames = require('classnames');

module.exports = function(component) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = React.createClass({
return {
error: null,
valid: true
}
};
},

getDefaultProps: function() {
Expand All @@ -33,29 +33,30 @@ module.exports = React.createClass({
};
},

handleChange: function(elm){
handleChange: function(e){

if( !this.formatting){
this.formatting = true;
Payment.formatCardExpiry(document.querySelector('.credit-card-expire-input'));
}

var expires = elm.target.value;
var is_valid = true;
var expires = e.target.value;
var isValid = true;
var self = this;

if(expires.length > 0){
isValid = false;
var date = expires.split(' / ');
if(date.length === 2){
is_valid = Payment.fns.validateCardExpiry(date[0], date[1]);
isValid = Payment.fns.validateCardExpiry(date[0], date[1]);
}
}

clearTimeout(this.intent);
this.intent = setTimeout(function(){
self.setState({
valid: is_valid,
error: (is_valid) ? null : self.props.errorMessage
valid: isValid,
error: (isValid) ? null : self.props.errorMessage
});
}, 500);
},
Expand Down

0 comments on commit 8bfb401

Please sign in to comment.