test-entity-library-asm 3.9.30 → 3.9.31

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.
@@ -32,7 +32,15 @@ __decorate([
32
32
  comment: "Fecha del festivo.",
33
33
  transformer: {
34
34
  to: (value) => value, // guardamos tal cual
35
- from: (value) => value, // lo devolvemos como string
35
+ from: (value) => {
36
+ if (typeof value === "string")
37
+ return value; // ya es string, devuelve
38
+ // Convierte Date a YYYY-MM-DD
39
+ const y = value.getFullYear();
40
+ const m = (value.getMonth() + 1).toString().padStart(2, "0");
41
+ const d = value.getDate().toString().padStart(2, "0");
42
+ return `${y}-${m}-${d}`;
43
+ },
36
44
  },
37
45
  }),
38
46
  __metadata("design:type", String)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.9.30",
3
+ "version": "3.9.31",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,14 @@ export class CountryHoliday {
26
26
  comment: "Fecha del festivo.",
27
27
  transformer: {
28
28
  to: (value: string | Date) => value, // guardamos tal cual
29
- from: (value: string) => value, // lo devolvemos como string
29
+ from: (value: Date | string) => {
30
+ if (typeof value === "string") return value; // ya es string, devuelve
31
+ // Convierte Date a YYYY-MM-DD
32
+ const y = value.getFullYear();
33
+ const m = (value.getMonth() + 1).toString().padStart(2, "0");
34
+ const d = value.getDate().toString().padStart(2, "0");
35
+ return `${y}-${m}-${d}`;
36
+ },
30
37
  },
31
38
  })
32
39
  date: string;