anchor-validation
Advanced tools
Comparing version 1.2.8 to 1.2.9
@@ -5,10 +5,10 @@ 'use strict'; | ||
var getAge = function getAge(dateOfBirth) { | ||
if (!moment(dateOfBirth, 'YYYY-MM-DD', true).isValid()) { | ||
var getAge = function getAge(dateOfBirth, format) { | ||
if (!moment(dateOfBirth, format, true).isValid()) { | ||
return 0; | ||
} | ||
return moment().diff(moment(dateOfBirth, 'YYYY-MM-DD', true), 'years'); | ||
return moment().diff(moment(dateOfBirth, format, true), 'years'); | ||
}; | ||
module.exports = getAge; |
@@ -48,13 +48,13 @@ 'use strict'; | ||
var maxAge = exports.maxAge = function maxAge(max) { | ||
var maxAge = exports.maxAge = function maxAge(max, format) { | ||
return function (value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
return (0, _getAge2.default)(value) > max ? error : undefined; | ||
return (0, _getAge2.default)(value, format) > max ? error : undefined; | ||
}; | ||
}; | ||
var minAge = exports.minAge = function minAge(min) { | ||
var minAge = exports.minAge = function minAge(min, format) { | ||
return function (value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
return (0, _getAge2.default)(value) < min ? error : undefined; | ||
return (0, _getAge2.default)(value, format) < min ? error : undefined; | ||
}; | ||
@@ -61,0 +61,0 @@ }; |
{ | ||
"name": "anchor-validation", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "anchor-validation for anchor-ui kit", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
6751