async-validate
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -21,3 +21,7 @@ var util = require('util'); | ||
} | ||
var dt = moment(Date.parse(value), rule.format); | ||
var dt = !rule.format ? moment(new Date(value)) : moment(value, rule.format); | ||
//console.log('value %s', value); | ||
//console.log('format %s', rule.format); | ||
//console.log('date %s', dt); | ||
//console.log('date valid %s', dt.isValid()); | ||
if(!dt) { | ||
@@ -24,0 +28,0 @@ errors.push(error(rule, |
@@ -16,2 +16,4 @@ var util = require('util'); | ||
var pattern = function(rule, value, source, errors, options) { | ||
//console.log('testing pattern %s', value); | ||
//console.log('testing with rule %s', rule.pattern); | ||
if(rule.pattern instanceof RegExp) { | ||
@@ -18,0 +20,0 @@ if(!rule.pattern.test(value)) { |
{ | ||
"name": "async-validate", | ||
"description": "Asynchronous validation for object properties.", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -50,4 +50,3 @@ var util = require('util'); | ||
validator.validate({active: "13-06-24"}, function(errors, fields) { | ||
assert.equal(errors.length, 2); | ||
//console.log(errors); | ||
assert.equal(errors.length, 1); | ||
assert.equal(errors[0].message, | ||
@@ -54,0 +53,0 @@ "active value 13-06-24 does not match pattern " + ptn); |
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
75319
1741