All files / output cl_abap_tstmp.clas.mjs

38.23% Statements 104/272
37.5% Branches 6/16
7.24% Functions 5/69
38.23% Lines 104/272

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 2721x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                   1x       1x     1x             1x     1x                                   1x     1x               1x     1x 9x 9x 9x 9x 9x 1x     1x                             1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x     1x 1x 1x 1x 1x     1x 2x 2x 2x 2x 2x       2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x     1x 2x 2x 2x 2x 2x       2x 2x 2x 2x 2x 1x     1x               1x     1x                                       1x     1x                                                                                       1x                       1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// cl_abap_tstmp.clas.abap
class cl_abap_tstmp {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CL_ABAP_TSTMP';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"OP_MODE_NEXT": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});}, "visibility": "U", "is_constant": "X", "is_class": "X"},
  "OP_MODE_BEFORE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});}, "visibility": "U", "is_constant": "X", "is_class": "X"},
  "OP_MODE_WALLCLOCK": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}};
  static METHODS = {"SUBTRACT": {"visibility": "U", "parameters": {"R_SECS": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " ", "parm_kind": "R", "type_name": "IntegerType"}, "TSTMP1": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}, "TSTMP2": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}}},
  "ADD": {"visibility": "U", "parameters": {"TIME": {"type": () => {return new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});}, "is_optional": " ", "parm_kind": "R", "type_name": "PackedType"}, "TSTMP": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}, "SECS": {"type": () => {return new abap.types.Packed({length: 8, decimals: 2});}, "is_optional": " ", "parm_kind": "I", "type_name": "NumericGenericType"}}},
  "SUBTRACTSECS": {"visibility": "U", "parameters": {"TIME": {"type": () => {return new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});}, "is_optional": " ", "parm_kind": "R", "type_name": "PackedType"}, "TSTMP": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}, "SECS": {"type": () => {return new abap.types.Packed({length: 8, decimals: 2});}, "is_optional": " ", "parm_kind": "I", "type_name": "NumericGenericType"}}},
  "TD_ADD": {"visibility": "U", "parameters": {"DATE": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "I", "type_name": "DateType"}, "TIME": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "I", "type_name": "TimeType"}, "SECS": {"type": () => {return new abap.types.Packed({length: 8, decimals: 2});}, "is_optional": " ", "parm_kind": "I", "type_name": "NumericGenericType"}, "RES_DATE": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "E", "type_name": "DateType"}, "RES_TIME": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "E", "type_name": "TimeType"}}},
  "MOVE": {"visibility": "U", "parameters": {"TSTMP_SRC": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}, "TSTMP_TGT": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "E", "type_name": "PackedType"}}},
  "SYSTEMTSTMP_SYST2UTC": {"visibility": "U", "parameters": {"SYST_DATE": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "I", "type_name": "DateType"}, "SYST_TIME": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "I", "type_name": "TimeType"}, "UTC_TSTMP": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "E", "type_name": "PackedType"}}},
  "MOVE_TO_SHORT": {"visibility": "U", "parameters": {"TSTMP_OUT": {"type": () => {return new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TZNTSTMPS"});}, "is_optional": " ", "parm_kind": "R", "type_name": "PackedType"}, "TSTMP_SRC": {"type": () => {return new abap.types.Packed({length: 21, decimals: 7, qualifiedName: "TZNTSTMPL"});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}}},
  "TD_SUBTRACT": {"visibility": "U", "parameters": {"DATE1": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "I", "type_name": "DateType"}, "TIME1": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "I", "type_name": "TimeType"}, "DATE2": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "I", "type_name": "DateType"}, "TIME2": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "I", "type_name": "TimeType"}, "RES_SECS": {"type": () => {return new abap.types.Packed({length: 8, decimals: 2});}, "is_optional": " ", "parm_kind": "E", "type_name": "NumericGenericType"}}},
  "SYSTEMTSTMP_UTC2SYST": {"visibility": "U", "parameters": {"UTC_TSTMP": {"type": () => {return new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}, "SYST_DATE": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "E", "type_name": "DateType"}, "SYST_TIME": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "E", "type_name": "TimeType"}}},
  "UTCLONG2TSTMP_SHORT": {"visibility": "U", "parameters": {"TIMESTAMP": {"type": () => {return new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});}, "is_optional": " ", "parm_kind": "R", "type_name": "PackedType"}, "UTCLONG": {"type": () => {return new abap.types.UTCLong();}, "is_optional": " ", "parm_kind": "I", "type_name": "UTCLongType"}}},
  "MAKE_VALID_TIME": {"visibility": "U", "parameters": {"DATE_IN": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "I", "type_name": "DateType"}, "TIME_IN": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "I", "type_name": "TimeType"}, "TIME_ZONE": {"type": () => {return new abap.types.Character(6, {"qualifiedName":"TIMEZONE","ddicName":"TIMEZONE","description":"TIMEZONE"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}, "MODE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}, "DATE_VALID": {"type": () => {return new abap.types.Date({qualifiedName: "D"});}, "is_optional": " ", "parm_kind": "E", "type_name": "DateType"}, "TIME_VALID": {"type": () => {return new abap.types.Time({qualifiedName: "T"});}, "is_optional": " ", "parm_kind": "E", "type_name": "TimeType"}}},
  "TSTMP2UTCLONG": {"visibility": "U", "parameters": {"UTCLONG": {"type": () => {return new abap.types.UTCLong();}, "is_optional": " ", "parm_kind": "R", "type_name": "UTCLongType"}, "TIMESTAMP": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
    this.op_mode_next = cl_abap_tstmp.op_mode_next;
    this.op_mode_before = cl_abap_tstmp.op_mode_before;
    this.op_mode_wallclock = cl_abap_tstmp.op_mode_wallclock;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async utclong2tstmp_short(INPUT) {
    return cl_abap_tstmp.utclong2tstmp_short(INPUT);
  }
  static async utclong2tstmp_short(INPUT) {
    let timestamp = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    let utclong = INPUT?.utclong;
    if (utclong === undefined) { utclong = new abap.types.UTCLong().set(INPUT.utclong); }
    timestamp.set(utclong);
    return timestamp;
  }
  async td_add(INPUT) {
    return cl_abap_tstmp.td_add(INPUT);
  }
  static async td_add(INPUT) {
    let date = INPUT?.date;
    if (date?.getQualifiedName === undefined || date.getQualifiedName() !== "D") { date = undefined; }
    if (date === undefined) { date = new abap.types.Date({qualifiedName: "D"}).set(INPUT.date); }
    let time = INPUT?.time;
    if (time?.getQualifiedName === undefined || time.getQualifiedName() !== "T") { time = undefined; }
    if (time === undefined) { time = new abap.types.Time({qualifiedName: "T"}).set(INPUT.time); }
    let secs = INPUT?.secs;
    if (secs.constructor.name === "Character") {
        secs = new abap.types.Packed({length: 8, decimals: 2});
        secs.set(INPUT?.secs);
    }
    let res_date = INPUT?.res_date || new abap.types.Date({qualifiedName: "D"});
    let res_time = INPUT?.res_time || new abap.types.Time({qualifiedName: "T"});
    let td = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    td.set((await this.add({tstmp: new abap.types.String().set(`${abap.templateFormatting(date)}${abap.templateFormatting(time)}`), secs: secs})));
    abap.statements.convert({stamp: td}, {date: res_date,time: res_time});
  }
  async systemtstmp_utc2syst(INPUT) {
    return cl_abap_tstmp.systemtstmp_utc2syst(INPUT);
  }
  static async systemtstmp_utc2syst(INPUT) {
    let utc_tstmp = INPUT?.utc_tstmp;
    if (utc_tstmp?.getQualifiedName === undefined || utc_tstmp.getQualifiedName() !== "TIMESTAMP") { utc_tstmp = undefined; }
    if (utc_tstmp === undefined) { utc_tstmp = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"}).set(INPUT.utc_tstmp); }
    let syst_date = INPUT?.syst_date || new abap.types.Date({qualifiedName: "D"});
    let syst_time = INPUT?.syst_time || new abap.types.Time({qualifiedName: "T"});
    abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
  }
  async move(INPUT) {
    return cl_abap_tstmp.move(INPUT);
  }
  static async move(INPUT) {
    let tstmp_src = INPUT?.tstmp_src;
    if (tstmp_src === undefined) { tstmp_src = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.tstmp_src); }
    let tstmp_tgt = INPUT?.tstmp_tgt || new abap.types.Packed({length: 1, decimals: 0});
    tstmp_tgt.set(tstmp_src);
  }
  async systemtstmp_syst2utc(INPUT) {
    return cl_abap_tstmp.systemtstmp_syst2utc(INPUT);
  }
  static async systemtstmp_syst2utc(INPUT) {
    let syst_date = INPUT?.syst_date;
    if (syst_date?.getQualifiedName === undefined || syst_date.getQualifiedName() !== "D") { syst_date = undefined; }
    if (syst_date === undefined) { syst_date = new abap.types.Date({qualifiedName: "D"}).set(INPUT.syst_date); }
    let syst_time = INPUT?.syst_time;
    if (syst_time?.getQualifiedName === undefined || syst_time.getQualifiedName() !== "T") { syst_time = undefined; }
    if (syst_time === undefined) { syst_time = new abap.types.Time({qualifiedName: "T"}).set(INPUT.syst_time); }
    let utc_tstmp = INPUT?.utc_tstmp || new abap.types.Packed({length: 1, decimals: 0});
    if (abap.compare.initial(syst_date)) {
      const unique1433 = await (new abap.Classes['CX_PARAMETER_INVALID_RANGE']()).constructor_();
      unique1433.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_tstmp.clas.abap","INTERNAL_LINE": 145};
      throw unique1433;
    }
    utc_tstmp.set(new abap.types.String().set(`${abap.templateFormatting(syst_date)}${abap.templateFormatting(syst_time)}`));
  }
  async subtract(INPUT) {
    return cl_abap_tstmp.subtract(INPUT);
  }
  static async subtract(INPUT) {
    let r_secs = new abap.types.Integer({qualifiedName: "I"});
    let tstmp1 = INPUT?.tstmp1;
    if (tstmp1 === undefined) { tstmp1 = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.tstmp1); }
    let tstmp2 = INPUT?.tstmp2;
    if (tstmp2 === undefined) { tstmp2 = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.tstmp2); }
    let str = new abap.types.String({qualifiedName: "STRING"});
    let lv_dummy = new abap.types.String({qualifiedName: "STRING"});
    str.set(new abap.types.String().set(`${abap.templateFormatting(tstmp1,{"timestamp":"iso"})}`));
    if (abap.compare.ca(str, abap.CharacterFactory.get(1, ','))) {
      abap.statements.split({source: str, at: abap.CharacterFactory.get(1, ','), targets: [str,lv_dummy]});
    }
    let t1 = Date.parse(str.get());
    str.set(new abap.types.String().set(`${abap.templateFormatting(tstmp2,{"timestamp":"iso"})}`));
    if (abap.compare.ca(str, abap.CharacterFactory.get(1, ','))) {
      abap.statements.split({source: str, at: abap.CharacterFactory.get(1, ','), targets: [str,lv_dummy]});
    }
    let t2 = Date.parse(str.get());
    r_secs.set((t1 - t2)/1000);
    return r_secs;
  }
  async add(INPUT) {
    return cl_abap_tstmp.add(INPUT);
  }
  static async add(INPUT) {
    let time = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    let tstmp = INPUT?.tstmp;
    if (tstmp === undefined) { tstmp = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.tstmp); }
    let secs = INPUT?.secs;
    if (secs.constructor.name === "Character") {
        secs = new abap.types.Packed({length: 8, decimals: 2});
        secs.set(INPUT?.secs);
    }
    let str = new abap.types.String({qualifiedName: "STRING"});
    let lv_dummy = new abap.types.String({qualifiedName: "STRING"});
    str.set(new abap.types.String().set(`${abap.templateFormatting(tstmp,{"timestamp":"iso"})}`));
    if (abap.compare.ca(str, abap.CharacterFactory.get(1, ','))) {
      abap.statements.split({source: str, at: abap.CharacterFactory.get(1, ','), targets: [str,lv_dummy]});
    }
    let t1 = new Date(Date.parse(str.get() + "Z"));
    t1.setSeconds( t1.getSeconds() + secs.get() );
    time.set(t1.toISOString().slice(0, 19).replace(/-/g, "").replace(/:/g, "").replace("T", ""));
    return time;
  }
  async subtractsecs(INPUT) {
    return cl_abap_tstmp.subtractsecs(INPUT);
  }
  static async subtractsecs(INPUT) {
    let time = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    let tstmp = INPUT?.tstmp;
    if (tstmp === undefined) { tstmp = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.tstmp); }
    let secs = INPUT?.secs;
    if (secs.constructor.name === "Character") {
        secs = new abap.types.Packed({length: 8, decimals: 2});
        secs.set(INPUT?.secs);
    }
    let lv_secs = new abap.types.Integer({qualifiedName: "I"});
    lv_secs.set(abap.operators.multiply(secs,abap.IntegerFactory.get(-1)));
    time.set((await this.add({tstmp: tstmp, secs: lv_secs})));
    return time;
  }
  async move_to_short(INPUT) {
    return cl_abap_tstmp.move_to_short(INPUT);
  }
  static async move_to_short(INPUT) {
    let tstmp_out = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TZNTSTMPS"});
    let tstmp_src = INPUT?.tstmp_src;
    if (tstmp_src?.getQualifiedName === undefined || tstmp_src.getQualifiedName() !== "TZNTSTMPL") { tstmp_src = undefined; }
    if (tstmp_src === undefined) { tstmp_src = new abap.types.Packed({length: 21, decimals: 7, qualifiedName: "TZNTSTMPL"}).set(INPUT.tstmp_src); }
    await this.move({tstmp_src: tstmp_src, tstmp_tgt: tstmp_out});
    return tstmp_out;
  }
  async td_subtract(INPUT) {
    return cl_abap_tstmp.td_subtract(INPUT);
  }
  static async td_subtract(INPUT) {
    let date1 = INPUT?.date1;
    if (date1?.getQualifiedName === undefined || date1.getQualifiedName() !== "D") { date1 = undefined; }
    if (date1 === undefined) { date1 = new abap.types.Date({qualifiedName: "D"}).set(INPUT.date1); }
    let time1 = INPUT?.time1;
    if (time1?.getQualifiedName === undefined || time1.getQualifiedName() !== "T") { time1 = undefined; }
    if (time1 === undefined) { time1 = new abap.types.Time({qualifiedName: "T"}).set(INPUT.time1); }
    let date2 = INPUT?.date2;
    if (date2?.getQualifiedName === undefined || date2.getQualifiedName() !== "D") { date2 = undefined; }
    if (date2 === undefined) { date2 = new abap.types.Date({qualifiedName: "D"}).set(INPUT.date2); }
    let time2 = INPUT?.time2;
    if (time2?.getQualifiedName === undefined || time2.getQualifiedName() !== "T") { time2 = undefined; }
    if (time2 === undefined) { time2 = new abap.types.Time({qualifiedName: "T"}).set(INPUT.time2); }
    let res_secs = INPUT?.res_secs || new abap.types.Packed({length: 8, decimals: 2});
    let lv_stamp1 = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    let lv_stamp2 = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    abap.statements.convert({date: date1,time: time1}, {stamp: lv_stamp1});
    abap.statements.convert({date: date2,time: time2}, {stamp: lv_stamp2});
    res_secs.set((await this.subtract({tstmp1: lv_stamp1, tstmp2: lv_stamp2})));
  }
  async make_valid_time(INPUT) {
    return cl_abap_tstmp.make_valid_time(INPUT);
  }
  static async make_valid_time(INPUT) {
    let date_in = INPUT?.date_in;
    if (date_in?.getQualifiedName === undefined || date_in.getQualifiedName() !== "D") { date_in = undefined; }
    if (date_in === undefined) { date_in = new abap.types.Date({qualifiedName: "D"}).set(INPUT.date_in); }
    let time_in = INPUT?.time_in;
    if (time_in?.getQualifiedName === undefined || time_in.getQualifiedName() !== "T") { time_in = undefined; }
    if (time_in === undefined) { time_in = new abap.types.Time({qualifiedName: "T"}).set(INPUT.time_in); }
    let time_zone = INPUT?.time_zone;
    if (time_zone?.getQualifiedName === undefined || time_zone.getQualifiedName() !== "TIMEZONE") { time_zone = undefined; }
    if (time_zone === undefined) { time_zone = new abap.types.Character(6, {"qualifiedName":"TIMEZONE","ddicName":"TIMEZONE","description":"TIMEZONE"}).set(INPUT.time_zone); }
    let mode = new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});
    if (INPUT && INPUT.mode) {mode.set(INPUT.mode);}
    if (INPUT === undefined || INPUT.mode === undefined) {mode = this.op_mode_wallclock;}
    let date_valid = INPUT?.date_valid || new abap.types.Date({qualifiedName: "D"});
    let time_valid = INPUT?.time_valid || new abap.types.Time({qualifiedName: "T"});
    let lv_out = new abap.types.String({qualifiedName: "STRING"});
    const SAP_IANA={"UTC":"UTC","CET":"Europe/Berlin","WET":"Europe/London","EET":"Europe/Helsinki","MSK":"Europe/Moscow","EST":"America/New_York","CST":"America/Chicago","MST":"America/Denver","PST":"America/Los_Angeles","JST":"Asia/Tokyo","AEST":"Australia/Sydney","IST":"Asia/Kolkata","GST":"Asia/Dubai"};
    const zone=SAP_IANA[time_zone.get().trim()]||time_zone.get().trim()||"UTC";
    const d=date_in.get(),t=time_in.get(),input=d+t;
    const fmtr=new Intl.DateTimeFormat("sv",{timeZone:zone,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false});
    const fmt=ms=>fmtr.format(new Date(ms)).replace(/[^0-9]/g,"");
    const toMs=s=>Date.UTC(+s.slice(0,4),+s.slice(4,6)-1,+s.slice(6,8),+s.slice(8,10),+s.slice(10,12),+s.slice(12,14));
    const off=ms=>toMs(fmt(ms))-ms;
    const toUTC=s=>{const ms=toMs(s);return ms-off(ms-off(ms));};
    const isValid=s=>fmt(toUTC(s))===s;
    const addSecs=(s,n)=>{const dt=new Date(toMs(s)+n*1000);return String(dt.getUTCFullYear()).padStart(4,"0")+String(dt.getUTCMonth()+1).padStart(2,"0")+String(dt.getUTCDate()).padStart(2,"0")+String(dt.getUTCHours()).padStart(2,"0")+String(dt.getUTCMinutes()).padStart(2,"0")+String(dt.getUTCSeconds()).padStart(2,"0");};
    let outDate=d,outTime=t;
    if(!isValid(input)){
      const mv=mode.get().trim();
      if(mv==="W"){
        const ms=toMs(input),local=fmt(ms-off(ms-86400000));
        outDate=local.slice(0,8);outTime=local.slice(8,14);
      }else{
        const step=mv==="B"?-1:1;let loc=input;
        for(let i=0;i<7200;i++){loc=addSecs(loc,step);if(isValid(loc)){outDate=loc.slice(0,8);outTime=loc.slice(8,14);break;}}
      }
  }
  lv_out.set(outDate+outTime);
  date_valid.set(lv_out.getOffset({length: 8}));
  time_valid.set(lv_out.getOffset({offset: 8, length: 6}));
}
async tstmp2utclong(INPUT) {
  return cl_abap_tstmp.tstmp2utclong(INPUT);
}
static async tstmp2utclong(INPUT) {
  let utclong = new abap.types.UTCLong();
  let timestamp = INPUT?.timestamp;
  if (timestamp === undefined) { timestamp = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.timestamp); }
  const str = String(timestamp.get());
  if (str.length < 14) throw new Error("CX_SY_CONVERSION_NO_DATE_TIME");
  const iso = str.slice(0,4) + "-" + str.slice(4,6) + "-" + str.slice(6,8) + "T" +
               str.slice(8,10) + ":" + str.slice(10,12) + ":" + str.slice(12,14) + "Z";
  const d = new Date(iso);
  utclong.value = d.toISOString().replace(/\.\d{3}Z$/, ".0000000");
  return utclong;
}
}
abap.Classes['CL_ABAP_TSTMP'] = cl_abap_tstmp;
cl_abap_tstmp.op_mode_next = new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});
cl_abap_tstmp.op_mode_next.set('N');
cl_abap_tstmp.op_mode_before = new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});
cl_abap_tstmp.op_mode_before.set('B');
cl_abap_tstmp.op_mode_wallclock = new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});
cl_abap_tstmp.op_mode_wallclock.set('W');
cl_abap_tstmp.operation_mode = new abap.types.Character(1, {"qualifiedName":"cl_abap_tstmp=>operation_mode"});
export {cl_abap_tstmp};