only validate expiry when both are set

This commit is contained in:
Henry Oswald 2014-12-28 21:53:12 +00:00
parent 1a4825a47b
commit 474fa5fe19

View file

@ -16,8 +16,8 @@ define [
$scope.data =
number: ""
month: ""
year: ""
month: undefined
year: undefined
cvv: ""
first_name: ""
last_name: ""
@ -60,7 +60,8 @@ define [
$scope.validation.correctCardNumber = recurly.validate.cardNumber($scope.data.number)
$scope.validateExpiry = ->
$scope.validation.correctExpiry = recurly.validate.expiry($scope.data.month, $scope.data.year)
if $scope.data.month? and $scope.data.year?
$scope.validation.correctExpiry = recurly.validate.expiry($scope.data.month, $scope.data.year)
$scope.validateCvv = ->
$scope.validation.correctCvv = recurly.validate.cvv($scope.data.cvv)