test-entity-library-asm 3.9.14 → 3.9.16

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.
@@ -4,5 +4,5 @@ export declare class CountryHoliday {
4
4
  name: string;
5
5
  date: string;
6
6
  country: Country;
7
- created: Date;
7
+ created: string;
8
8
  }
@@ -48,7 +48,7 @@ __decorate([
48
48
  transformer: new dateTransformer_1.DateTransformer(),
49
49
  comment: "Fecha de creación del registro.",
50
50
  }),
51
- __metadata("design:type", Date)
51
+ __metadata("design:type", String)
52
52
  ], CountryHoliday.prototype, "created", void 0);
53
53
  exports.CountryHoliday = CountryHoliday = __decorate([
54
54
  (0, typeorm_1.Entity)("country_holiday", {
@@ -12,13 +12,10 @@ class DateTransformer {
12
12
  return result;
13
13
  }
14
14
  from(value) {
15
- if (!value)
15
+ if (value === null)
16
16
  return null;
17
- // Interpreta el valor de la DB como UTC
18
- const utcMoment = moment_timezone_1.default.utc(value);
19
- // Convierte a la zona del usuario y devuelve como string
20
- const tz = (0, __1.getTimeZone)(); // "America/Bogota", etc.
21
- return utcMoment.tz(tz).format("YYYY-MM-DD HH:mm:ss");
17
+ const result = moment_timezone_1.default.utc(value).tz((0, __1.getTimeZone)()).toDate();
18
+ return result;
22
19
  }
23
20
  }
24
21
  exports.DateTransformer = DateTransformer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.9.14",
3
+ "version": "3.9.16",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,5 +39,5 @@ export class CountryHoliday {
39
39
  transformer: new DateTransformer(),
40
40
  comment: "Fecha de creación del registro.",
41
41
  })
42
- created: Date;
42
+ created: string;
43
43
  }
@@ -9,13 +9,9 @@ export class DateTransformer implements ValueTransformer {
9
9
  }
10
10
 
11
11
  from(value: string): Date | null | string {
12
- if (!value) return null;
12
+ if (value === null) return null;
13
13
 
14
- // Interpreta el valor de la DB como UTC
15
- const utcMoment = moment.utc(value);
16
-
17
- // Convierte a la zona del usuario y devuelve como string
18
- const tz = getTimeZone(); // "America/Bogota", etc.
19
- return utcMoment.tz(tz).format("YYYY-MM-DD HH:mm:ss");
14
+ const result = moment.utc(value).tz(getTimeZone()).toDate();
15
+ return result;
20
16
  }
21
17
  }