@webtypen/webframez-core 0.3.5 → 0.3.7

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.
@@ -303,6 +303,24 @@ class DataBuilder {
303
303
  else if (fields[key].type === "integer") {
304
304
  elementVal = parseInt(value);
305
305
  }
306
+ // Integer datetime
307
+ else if (fields[key].type === "datetime") {
308
+ if (typeof value === "string") {
309
+ const [datePart, timePart] = value.trim().split(" ");
310
+ if (!datePart || datePart.trim() === "") {
311
+ elementVal = value;
312
+ }
313
+ else if (!datePart.includes("-") && datePart.match(/^\d{1,2}:\d{2}$/)) {
314
+ elementVal = null;
315
+ }
316
+ else {
317
+ elementVal = datePart.trim() + " " + (timePart && timePart.includes(":") ? timePart.trim() : "00:00");
318
+ }
319
+ }
320
+ else {
321
+ elementVal = null;
322
+ }
323
+ }
306
324
  // Standard
307
325
  else {
308
326
  elementVal = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -380,6 +380,22 @@ export class DataBuilder {
380
380
  elementVal = parseInt(value);
381
381
  }
382
382
 
383
+ // Integer datetime
384
+ else if (fields[key].type === "datetime") {
385
+ if (typeof value === "string") {
386
+ const [datePart, timePart] = value.trim().split(" ");
387
+ if (!datePart || datePart.trim() === "") {
388
+ elementVal = value;
389
+ } else if (!datePart.includes("-") && datePart.match(/^\d{1,2}:\d{2}$/)) {
390
+ elementVal = null;
391
+ } else {
392
+ elementVal = datePart.trim() + " " + (timePart && timePart.includes(":") ? timePart.trim() : "00:00");
393
+ }
394
+ } else {
395
+ elementVal = null;
396
+ }
397
+ }
398
+
383
399
  // Standard
384
400
  else {
385
401
  elementVal = value;