diff options
-rw-r--r-- | epirts.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -81,6 +81,22 @@ var Stripe = Epirts = (function() { }; pub.validateExpiry = function(month, year) { + var today; + + today = new Date(); + month = parseInt(month, 10); + year = parseInt(year, 10); + if (isNaN(month) || isNaN(year)) { + return false; + } else if (month < 1 || month > 12) { + return false; + } else if (year < today.getFullYear()) { + return false; + } else if (year === today.getFullYear() && + month <= today.getMonth()) { + return false; + } + return true; }; pub.validateCVC = function(cvc) { |