Better integration with Angular models.

This commit is contained in:
Paulo Reis 2016-08-18 10:39:55 +01:00
parent 4814fc2606
commit 1af5017e49

View file

@ -90,6 +90,8 @@ define [
month = parseInt(month, 10) month = parseInt(month, 10)
year = parseInt(year, 10) year = parseInt(year, 10)
return unless !isNaN(month) and !isNaN(year)
month: month, year: year month: month, year: year
return { return {
@ -271,8 +273,14 @@ define [
parseExpiry = (value) -> parseExpiry = (value) ->
if value? if value?
dateAsObj = ccUtils.parseExpiry(value); dateAsObj = ccUtils.parseExpiry(value)
console.log dateAsObj
return unless dateAsObj?
expiry = new Date dateAsObj.year, dateAsObj.month - 1 expiry = new Date dateAsObj.year, dateAsObj.month - 1
return $filter('date')(expiry, 'MM/yyyy') return $filter('date')(expiry, 'MM/yyyy')
# Format CVC # Format CVC