1 | var Valida = require('..');
|
2 |
|
3 |
|
4 | var schema = {
|
5 | birthday: [
|
6 | { sanitizer: Valida.Sanitizer.toDate }
|
7 | ]
|
8 | };
|
9 |
|
10 |
|
11 | var person = { birthday: 'Tue Oct 08 2013 19:09:56 GMT-0300 (BRT)' };
|
12 |
|
13 |
|
14 | Valida.process(person, schema, function(err, ctx) {
|
15 |
|
16 | console.log(person, Object.prototype.toString.call(person.birthday));
|
17 | });
|
18 |
|
19 |
|
20 | person.birthday = new Date();
|
21 |
|
22 |
|
23 | Valida.process(person, schema, function(err, ctx) {
|
24 |
|
25 | console.log(person, Object.prototype.toString.call(person.birthday));
|
26 | });
|