test-entity-library-asm 1.7.7 → 1.7.9

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.
@@ -112,7 +112,6 @@ var Partner = /** @class */ (function () {
112
112
  ], Partner.prototype, "owner", void 0);
113
113
  __decorate([
114
114
  (0, typeorm_1.Column)({
115
- type: 'datetime',
116
115
  transformer: new dateTransformer_1.DateTransformer(),
117
116
  comment: 'Fecha de creación del registro.',
118
117
  }),
@@ -6,10 +6,10 @@ var DateTransformer = /** @class */ (function () {
6
6
  function DateTransformer() {
7
7
  }
8
8
  DateTransformer.prototype.to = function (value) {
9
- return value; // Deja la fecha en UTC al guardar en la base de datos
9
+ return moment(value).utc().format('YYYY-MM-DD HH:mm:ss');
10
10
  };
11
11
  DateTransformer.prototype.from = function (value) {
12
- return moment.utc(value).tz('America/Bogota').format('YYYY-MM-DD HH:mm:ss'); // Convierte de UTC a la zona horaria local al recuperar de la base de datos
12
+ return moment.utc(value).tz('America/Bogota').format('YYYY-MM-DD HH:mm:ss');
13
13
  };
14
14
  return DateTransformer;
15
15
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -100,7 +100,6 @@ export class Partner {
100
100
  owner: number
101
101
 
102
102
  @Column({
103
- type: 'datetime',
104
103
  transformer: new DateTransformer(),
105
104
  comment: 'Fecha de creación del registro.',
106
105
  })
@@ -3,10 +3,10 @@ import * as moment from 'moment-timezone'
3
3
 
4
4
  export class DateTransformer implements ValueTransformer {
5
5
  to(value: string): string {
6
- return value // Deja la fecha en UTC al guardar en la base de datos
6
+ return moment(value).utc().format('YYYY-MM-DD HH:mm:ss')
7
7
  }
8
8
 
9
9
  from(value: string): string {
10
- return moment.utc(value).tz('America/Bogota').format('YYYY-MM-DD HH:mm:ss') // Convierte de UTC a la zona horaria local al recuperar de la base de datos
10
+ return moment.utc(value).tz('America/Bogota').format('YYYY-MM-DD HH:mm:ss')
11
11
  }
12
12
  }