test-entity-library-asm 2.4.4 → 2.4.6

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.
@@ -1,5 +1,5 @@
1
1
  import { ValueTransformer } from 'typeorm';
2
2
  export declare class DateTransformer implements ValueTransformer {
3
- to(value: any): string;
3
+ to(value: Date | string): string;
4
4
  from(value: string): string;
5
5
  }
@@ -7,10 +7,17 @@ var DateTransformer = /** @class */ (function () {
7
7
  function DateTransformer() {
8
8
  }
9
9
  DateTransformer.prototype.to = function (value) {
10
- return value;
10
+ var result = moment(value).format('YYYY-MM-DD HH:mm:ss');
11
+ console.log('To Value:', value, 'Transformed to:', result);
12
+ return result;
11
13
  };
12
14
  DateTransformer.prototype.from = function (value) {
13
- return moment.utc(value).tz((0, __1.getTimeZone)()).format('YYYY-MM-DD HH:mm:ss');
15
+ var result = moment
16
+ .utc(value)
17
+ .tz((0, __1.getTimeZone)())
18
+ .format('YYYY-MM-DD HH:mm:ss');
19
+ console.log('From Value:', value, 'Transformed from:', result);
20
+ return result;
14
21
  };
15
22
  return DateTransformer;
16
23
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
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,11 +3,18 @@ import * as moment from 'moment-timezone'
3
3
  import { getTimeZone } from '..'
4
4
 
5
5
  export class DateTransformer implements ValueTransformer {
6
- to(value: any): string {
7
- return value
6
+ to(value: Date | string): string {
7
+ const result = moment(value).format('YYYY-MM-DD HH:mm:ss')
8
+ console.log('To Value:', value, 'Transformed to:', result)
9
+ return result
8
10
  }
9
11
 
10
12
  from(value: string): string {
11
- return moment.utc(value).tz(getTimeZone()).format('YYYY-MM-DD HH:mm:ss')
13
+ const result = moment
14
+ .utc(value)
15
+ .tz(getTimeZone())
16
+ .format('YYYY-MM-DD HH:mm:ss')
17
+ console.log('From Value:', value, 'Transformed from:', result)
18
+ return result
12
19
  }
13
20
  }