Просмотр исходного кода

only validate expiry when both are set

Henry Oswald 11 лет назад
Родитель
Сommit
474fa5fe19
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      services/web/public/coffee/main/new-subscription.coffee

+ 4 - 3
services/web/public/coffee/main/new-subscription.coffee

@@ -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)