From 1af5017e49e2d2cc0c076aee183d4e0e013666de Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 18 Aug 2016 10:39:55 +0100 Subject: [PATCH] Better integration with Angular models. --- .../web/public/coffee/directives/creditCards.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/directives/creditCards.coffee b/services/web/public/coffee/directives/creditCards.coffee index ae9df139a9..70b485252a 100644 --- a/services/web/public/coffee/directives/creditCards.coffee +++ b/services/web/public/coffee/directives/creditCards.coffee @@ -90,6 +90,8 @@ define [ month = parseInt(month, 10) year = parseInt(year, 10) + return unless !isNaN(month) and !isNaN(year) + month: month, year: year return { @@ -271,8 +273,14 @@ define [ parseExpiry = (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 + return $filter('date')(expiry, 'MM/yyyy') # Format CVC