card-validator
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -0,1 +1,6 @@ | ||
2.2.2 | ||
===== | ||
- Fixes 3-digit expiration date handling, such as 220 being Feb, 2020 | ||
2.2.1 | ||
@@ -2,0 +7,0 @@ ===== |
{ | ||
"name": "card-validator", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "A library for validating credit card fields", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,3 +1,5 @@ | ||
var expirationYear = require('./expiration-year'); | ||
function parseDate(value) { | ||
var month, len; | ||
var month, len, year, yearValid; | ||
@@ -13,3 +15,12 @@ if (value.match('/')) { | ||
len = value[0] === '0' || value.length > 5 || value.length === 4 || value.length === 3 ? 2 : 1; | ||
len = value[0] === '0' || value.length > 5 || value.length === 4 ? 2 : 1; | ||
if (value.length === 3 && value[0] === '1') { | ||
year = value.substr(1, 2); | ||
yearValid = expirationYear(year); | ||
if (!yearValid.isValid) { | ||
len = 2; | ||
} | ||
} | ||
month = value.substr(0, len); | ||
@@ -16,0 +27,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86185
1764