ng2-validation
Advanced tools
Comparing version 3.2.4 to 3.3.0
@@ -100,4 +100,5 @@ "use strict"; | ||
CustomValidators.minDate = function (minDate) { | ||
if (!lang_1.isDate(minDate)) | ||
throw Error('minDate value must be a formatted date'); | ||
if (!lang_1.isDate(minDate) && !(minDate instanceof Function)) { | ||
throw Error('minDate value must be or return a formatted date'); | ||
} | ||
return function (control) { | ||
@@ -109,2 +110,4 @@ if (lang_1.isPresent(forms_1.Validators.required(control))) | ||
return { minDate: true }; | ||
if (minDate instanceof Function) | ||
minDate = minDate(); | ||
return d >= new Date(minDate) ? null : { minDate: true }; | ||
@@ -117,4 +120,5 @@ }; | ||
CustomValidators.maxDate = function (maxDate) { | ||
if (!lang_1.isDate(maxDate)) | ||
throw Error('maxDate value must be a formatted date'); | ||
if (!lang_1.isDate(maxDate) && !(maxDate instanceof Function)) { | ||
throw Error('maxDate value must be or return a formatted date'); | ||
} | ||
return function (control) { | ||
@@ -126,2 +130,4 @@ if (lang_1.isPresent(forms_1.Validators.required(control))) | ||
return { maxDate: true }; | ||
if (maxDate instanceof Function) | ||
maxDate = maxDate(); | ||
return d <= new Date(maxDate) ? null : { maxDate: true }; | ||
@@ -128,0 +134,0 @@ }; |
{ | ||
"name": "ng2-validation", | ||
"version": "3.2.4", | ||
"version": "3.3.0", | ||
"description": "angular2 validation", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
104109
1308