credit-card
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -153,3 +153,5 @@ var Hoek = require('hoek'); | ||
var expiration = new Date(year, month - 1); | ||
// cards are good until the end of the month | ||
// http://stackoverflow.com/questions/54037/credit-card-expiration-dates-inclusive-or-exclusive | ||
var expiration = new Date(year, month); | ||
@@ -156,0 +158,0 @@ return Date.now() >= expiration; |
{ | ||
"name": "credit-card", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "credit card validation", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -390,2 +390,17 @@ var Lab = require('lab'); | ||
}); | ||
it('returns true when card expired last month', function(done) { | ||
var date = new Date(); | ||
date.setMonth(date.getMonth() - 1); // last month | ||
expect(CreditCard.isExpired(date.getMonth() + 1, date.getFullYear())).to.equal(true); | ||
done(); | ||
}); | ||
it('returns false when card expires this month', function(done) { | ||
var date = new Date(); | ||
expect(CreditCard.isExpired(date.getMonth() + 1, date.getFullYear())).to.equal(false); | ||
done(); | ||
}); | ||
}); | ||
@@ -392,0 +407,0 @@ |
38749
667