test-entity-library-asm 1.8.9 → 1.9.1

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.
@@ -6,15 +6,12 @@ var DateTransformer = /** @class */ (function () {
6
6
  function DateTransformer() {
7
7
  }
8
8
  DateTransformer.prototype.to = function (value) {
9
- // Al guardar, nos aseguramos de que la fecha esté en UTC
9
+ // No es necesario transformar al guardar, se guarda en UTC
10
10
  return moment.utc(value).format('YYYY-MM-DD HH:mm:ss');
11
11
  };
12
12
  DateTransformer.prototype.from = function (value) {
13
- // Asegúrate de interpretar correctamente el valor de UTC y luego convertirlo a la zona horaria local
14
- var utcDate = moment.utc(value);
15
- var localDate = utcDate.tz('America/Bogota');
16
- console.log('Sin el format', utcDate, 'Fecha UTC:', utcDate.format(), 'Convertido a zona horaria local sin el format:', localDate, 'convirtiendo a zona horaria local con el format', localDate.format());
17
- return localDate.format();
13
+ // Convertir de UTC a la zona horaria local
14
+ return moment.utc(value).tz('America/Santiago').format('YYYY-MM-DD HH:mm:ss');
18
15
  };
19
16
  return DateTransformer;
20
17
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.8.9",
3
+ "version": "1.9.1",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,24 +3,12 @@ import * as moment from 'moment-timezone'
3
3
 
4
4
  export class DateTransformer implements ValueTransformer {
5
5
  to(value: Date | string): string {
6
- // Al guardar, nos aseguramos de que la fecha esté en UTC
6
+ // No es necesario transformar al guardar, se guarda en UTC
7
7
  return moment.utc(value).format('YYYY-MM-DD HH:mm:ss')
8
8
  }
9
9
 
10
10
  from(value: string): string {
11
- // Asegúrate de interpretar correctamente el valor de UTC y luego convertirlo a la zona horaria local
12
- const utcDate = moment.utc(value)
13
- const localDate = utcDate.tz('America/Bogota')
14
- console.log(
15
- 'Sin el format',
16
- utcDate,
17
- 'Fecha UTC:',
18
- utcDate.format(),
19
- 'Convertido a zona horaria local sin el format:',
20
- localDate,
21
- 'convirtiendo a zona horaria local con el format',
22
- localDate.format()
23
- )
24
- return localDate.format()
11
+ // Convertir de UTC a la zona horaria local
12
+ return moment.utc(value).tz('America/Santiago').format('YYYY-MM-DD HH:mm:ss')
25
13
  }
26
14
  }