test-entity-library-asm 2.4.4 → 2.4.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.
|
@@ -7,10 +7,17 @@ var DateTransformer = /** @class */ (function () {
|
|
|
7
7
|
function DateTransformer() {
|
|
8
8
|
}
|
|
9
9
|
DateTransformer.prototype.to = function (value) {
|
|
10
|
-
|
|
10
|
+
var result = moment.utc(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
|
-
|
|
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
|
@@ -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:
|
|
7
|
-
|
|
6
|
+
to(value: Date | string): string {
|
|
7
|
+
const result = moment.utc(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
|
-
|
|
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
|
}
|