diff options
author | P. J. McDermott <pj@pehjota.net> | 2015-03-15 23:19:49 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2015-03-15 23:19:49 (EDT) |
commit | 209c195d5b94de50ef5b727a1294b5130b7d46fa (patch) | |
tree | fae245f442ff28b883e52b006d124a8902e3b586 | |
parent | 64d0446f24411746424c4a9f004ace7238c2d3fe (diff) | |
download | epirts.js-209c195d5b94de50ef5b727a1294b5130b7d46fa.zip epirts.js-209c195d5b94de50ef5b727a1294b5130b7d46fa.tar.gz epirts.js-209c195d5b94de50ef5b727a1294b5130b7d46fa.tar.bz2 |
Epirts.card.validateExpiry(): Implement
-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) { |