@dzeio/schema 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Schema.js CHANGED
@@ -441,7 +441,16 @@ var SchemaDate = class extends SchemaItem {
441
441
  switch (format) {
442
442
  case "yy-mm-dd":
443
443
  case "iso8601": {
444
- this.addPreProcess((it) => typeof it === "string" ? new Date(it) : it);
444
+ this.addPreProcess((it) => {
445
+ if (typeof it !== "string") {
446
+ return it;
447
+ }
448
+ const date = new Date(it);
449
+ if (isNaN(date.getDate())) {
450
+ return it;
451
+ }
452
+ return date;
453
+ });
445
454
  break;
446
455
  }
447
456
  case "jj/mm/yy": {
@@ -453,7 +462,11 @@ var SchemaDate = class extends SchemaItem {
453
462
  if (splitted.length !== 3) {
454
463
  return input;
455
464
  }
456
- return new Date(splitted[2], splitted[1] - 1, splitted[0]);
465
+ const date = new Date(splitted[2], splitted[1] - 1, splitted[0]);
466
+ if (isNaN(date.getDate())) {
467
+ return input;
468
+ }
469
+ return date;
457
470
  });
458
471
  }
459
472
  }
package/dist/Schema.mjs CHANGED
@@ -398,7 +398,16 @@ var SchemaDate = class extends SchemaItem {
398
398
  switch (format) {
399
399
  case "yy-mm-dd":
400
400
  case "iso8601": {
401
- this.addPreProcess((it) => typeof it === "string" ? new Date(it) : it);
401
+ this.addPreProcess((it) => {
402
+ if (typeof it !== "string") {
403
+ return it;
404
+ }
405
+ const date = new Date(it);
406
+ if (isNaN(date.getDate())) {
407
+ return it;
408
+ }
409
+ return date;
410
+ });
402
411
  break;
403
412
  }
404
413
  case "jj/mm/yy": {
@@ -410,7 +419,11 @@ var SchemaDate = class extends SchemaItem {
410
419
  if (splitted.length !== 3) {
411
420
  return input;
412
421
  }
413
- return new Date(splitted[2], splitted[1] - 1, splitted[0]);
422
+ const date = new Date(splitted[2], splitted[1] - 1, splitted[0]);
423
+ if (isNaN(date.getDate())) {
424
+ return input;
425
+ }
426
+ return date;
414
427
  });
415
428
  }
416
429
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzeio/schema",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "dependencies": {
5
5
  "@dzeio/object-util": "^1.8.3"
6
6
  },