test-entity-library-asm 1.7.3 → 1.7.5

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.
package/dist/index.js CHANGED
@@ -135,6 +135,7 @@ exports.timezoneMiddleware = timezoneMiddleware;
135
135
  function getTimeZone() {
136
136
  var _a;
137
137
  var store = asyncLocalStorage.getStore();
138
+ console.log(store, 'Prueba aer si funciona');
138
139
  return (_a = store === null || store === void 0 ? void 0 : store.get('timezone')) !== null && _a !== void 0 ? _a : 'UTC';
139
140
  }
140
141
  exports.getTimeZone = getTimeZone;
@@ -10,10 +10,16 @@ var DateTransformer = /** @class */ (function () {
10
10
  }
11
11
  DateTransformer.prototype.from = function (value) {
12
12
  var timeZone = (0, __1.getTimeZone)();
13
+ console.log("Converting ".concat(value, " from UTC to ").concat(timeZone));
13
14
  var zonedDate = (0, date_fns_tz_1.toZonedTime)(value, timeZone);
15
+ console.log("Converted date: ".concat(zonedDate));
16
+ console.log("Formatted date than return: ".concat((0, date_fns_tz_1.format)(zonedDate, this.format, {
17
+ timeZone: timeZone,
18
+ })));
14
19
  return (0, date_fns_tz_1.format)(zonedDate, this.format, { timeZone: timeZone });
15
20
  };
16
21
  DateTransformer.prototype.to = function (value) {
22
+ console.log("Converting ".concat(value, " to UTC"));
17
23
  return new Date(value); // Assuming the input is already in UTC
18
24
  };
19
25
  return DateTransformer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -91,6 +91,8 @@ export function timezoneMiddleware(
91
91
 
92
92
  export function getTimeZone(): string {
93
93
  const store = asyncLocalStorage.getStore()
94
+ console.log(store, 'Prueba aer si funciona')
95
+
94
96
  return store?.get('timezone') ?? 'UTC'
95
97
  }
96
98
 
@@ -12,11 +12,21 @@ export class DateTransformer implements ValueTransformer {
12
12
 
13
13
  from(value: Date): string {
14
14
  const timeZone = getTimeZone()
15
+ console.log(`Converting ${value} from UTC to ${timeZone}`)
15
16
  const zonedDate = toZonedTime(value, timeZone)
17
+ console.log(`Converted date: ${zonedDate}`)
18
+ console.log(
19
+ `Formatted date than return: ${format(zonedDate, this.format, {
20
+ timeZone,
21
+ })}`
22
+ )
23
+
16
24
  return format(zonedDate, this.format, { timeZone })
17
25
  }
18
26
 
19
27
  to(value: Date): Date {
28
+ console.log(`Converting ${value} to UTC`)
29
+
20
30
  return new Date(value) // Assuming the input is already in UTC
21
31
  }
22
32
  }