@abaplint/runtime 2.1.50 → 2.1.53
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.
|
@@ -5,6 +5,7 @@ export interface IConcatenateInput {
|
|
|
5
5
|
source: [number | string | INumeric | ICharacter | Table];
|
|
6
6
|
target: ICharacter;
|
|
7
7
|
separatedBy?: number | string | INumeric | ICharacter;
|
|
8
|
+
respectingBlanks?: boolean;
|
|
8
9
|
lines?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare function concatenate(input: IConcatenateInput): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ICharacter } from "../types/_character";
|
|
2
|
+
import { INumeric } from "../types/_numeric";
|
|
2
3
|
export interface IConvertSource {
|
|
3
4
|
date?: ICharacter | string;
|
|
4
5
|
time?: ICharacter | string;
|
|
5
|
-
stamp?: ICharacter | string;
|
|
6
|
+
stamp?: ICharacter | INumeric | string;
|
|
6
7
|
zone: ICharacter | string;
|
|
7
8
|
}
|
|
8
9
|
export interface IConvertTarget {
|
|
@@ -1,53 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convert = void 0;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("../types");
|
|
4
|
+
const temporal_polyfill_1 = require("temporal-polyfill");
|
|
6
5
|
function convert(source, target) {
|
|
7
6
|
var _a, _b, _c;
|
|
8
|
-
let
|
|
7
|
+
let date = "";
|
|
9
8
|
if (source.date) {
|
|
10
9
|
if (typeof source.date === "string") {
|
|
11
|
-
|
|
10
|
+
date = source.date;
|
|
12
11
|
}
|
|
13
12
|
else {
|
|
14
|
-
|
|
13
|
+
date = source.date.get();
|
|
15
14
|
}
|
|
16
15
|
}
|
|
16
|
+
let time = "";
|
|
17
17
|
if (source.time) {
|
|
18
18
|
if (typeof source.time === "string") {
|
|
19
|
-
|
|
19
|
+
time = source.time;
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
|
|
22
|
+
time = source.time.get();
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
let stamp = "";
|
|
25
26
|
if (source.stamp) {
|
|
26
27
|
if (typeof source.stamp === "string") {
|
|
27
|
-
|
|
28
|
+
stamp = source.stamp;
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
30
|
-
|
|
31
|
+
stamp = source.stamp.get() + "";
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
let zone = "";
|
|
35
|
+
if (source.zone) {
|
|
36
|
+
if (typeof source.zone === "string") {
|
|
37
|
+
zone = source.zone;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
zone = source.zone.get() + "";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (zone === "") {
|
|
44
|
+
zone = "UTC";
|
|
45
|
+
}
|
|
46
|
+
////////////////////////
|
|
47
|
+
let zoned = undefined;
|
|
48
|
+
if (date !== "" && time !== "") {
|
|
49
|
+
if (date === "00000000" && time === "000000") {
|
|
50
|
+
(_a = target.stamp) === null || _a === void 0 ? void 0 : _a.clear();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const pt = temporal_polyfill_1.Temporal.PlainTime.from(time.substring(0, 2) + ":" + time.substring(2, 4) + ":" + time.substring(4, 6));
|
|
54
|
+
zoned = temporal_polyfill_1.Temporal.PlainDate.from(date).toZonedDateTime({ timeZone: zone, plainTime: pt });
|
|
55
|
+
zoned = zoned.withTimeZone("UTC");
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (stamp === "0") {
|
|
59
|
+
(_b = target.date) === null || _b === void 0 ? void 0 : _b.clear();
|
|
60
|
+
(_c = target.time) === null || _c === void 0 ? void 0 : _c.clear();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const pt = temporal_polyfill_1.Temporal.PlainTime.from(stamp.substring(8, 10) + ":" + stamp.substring(10, 12) + ":" + stamp.substring(12, 14));
|
|
64
|
+
zoned = temporal_polyfill_1.Temporal.PlainDate.from(stamp.substring(0, 8)).toZonedDateTime({ timeZone: "UTC", plainTime: pt });
|
|
40
65
|
}
|
|
41
|
-
const
|
|
42
|
-
const
|
|
66
|
+
const d = zoned.toPlainDate().toString().replace(/-/g, "");
|
|
67
|
+
const t = zoned.toPlainTime().toString().replace(/:/g, "");
|
|
43
68
|
if (target.stamp) {
|
|
44
|
-
target.stamp.set(
|
|
69
|
+
target.stamp.set(d + t);
|
|
45
70
|
}
|
|
46
71
|
if (target.date) {
|
|
47
|
-
target.date.set(
|
|
72
|
+
target.date.set(d);
|
|
48
73
|
}
|
|
49
74
|
if (target.time) {
|
|
50
|
-
target.time.set(
|
|
75
|
+
target.time.set(t);
|
|
51
76
|
}
|
|
52
77
|
}
|
|
53
78
|
exports.convert = convert;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.53",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -34,5 +34,8 @@
|
|
|
34
34
|
"mocha": "^10.0.0",
|
|
35
35
|
"source-map-support": "^0.5.21",
|
|
36
36
|
"typescript": "^4.8.2"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"temporal-polyfill": "^0.0.8"
|
|
37
40
|
}
|
|
38
41
|
}
|