sigo-entities 0.0.180 → 0.0.181

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/index.js CHANGED
@@ -336,9 +336,12 @@ function formatErrors(errors, parentPath = "") {
336
336
 
337
337
  // src/shared/utils/convertStringsToDates.ts
338
338
  function convertStringsToDates(obj) {
339
- if (typeof obj === "string") {
340
- const date = new Date(obj);
341
- return isNaN(date.getTime()) ? obj : date;
339
+ const isValidDate = (str) => {
340
+ const date = new Date(str);
341
+ return !isNaN(date.getTime()) && str === date.toISOString();
342
+ };
343
+ if (typeof obj === "string" && isValidDate(obj)) {
344
+ return new Date(obj);
342
345
  }
343
346
  if (Array.isArray(obj)) {
344
347
  return obj.map((item) => convertStringsToDates(item));
package/dist/index.mjs CHANGED
@@ -97,9 +97,12 @@ function formatErrors(errors, parentPath = "") {
97
97
 
98
98
  // src/shared/utils/convertStringsToDates.ts
99
99
  function convertStringsToDates(obj) {
100
- if (typeof obj === "string") {
101
- const date = new Date(obj);
102
- return isNaN(date.getTime()) ? obj : date;
100
+ const isValidDate = (str) => {
101
+ const date = new Date(str);
102
+ return !isNaN(date.getTime()) && str === date.toISOString();
103
+ };
104
+ if (typeof obj === "string" && isValidDate(obj)) {
105
+ return new Date(obj);
103
106
  }
104
107
  if (Array.isArray(obj)) {
105
108
  return obj.map((item) => convertStringsToDates(item));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-entities",
3
- "version": "0.0.180",
3
+ "version": "0.0.181",
4
4
  "description": "Desarrollo de modelos de datos SIGO",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",