comand-component-library 4.1.87 → 4.1.88

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.
@@ -19469,7 +19469,7 @@ const b1 = /* @__PURE__ */ P(f1, [["render", y1]]), x1 = [
19469
19469
  text: "Zimbabwe",
19470
19470
  value: "zw"
19471
19471
  }
19472
- ], _1 = "comand-component-library", C1 = "4.1.87", v1 = "GPL-3.0-only", w1 = "CoManD-UI", k1 = "module", T1 = {
19472
+ ], _1 = "comand-component-library", C1 = "4.1.88", v1 = "GPL-3.0-only", w1 = "CoManD-UI", k1 = "module", T1 = {
19473
19473
  prepublishOnly: "npm run build-lib",
19474
19474
  dev: "vite",
19475
19475
  build: "vite build",
@@ -19523,7 +19523,7 @@ function Dk(e = !1) {
19523
19523
  }
19524
19524
  function F1(e, n = "dmy", t = ".") {
19525
19525
  const a = new Date(e);
19526
- isNaN(a) && console.error("function formatDate received an invalid date as parameter. Provide date in format YYYY-MM-DD");
19526
+ isNaN(a) && console.error("function 'formatDate' received an invalid date as parameter. Provide date in format YYYY-MM-DD");
19527
19527
  const i = a.getFullYear(), o = String(a.getMonth() + 1).padStart(2, "0"), d = String(a.getDate()).padStart(2, "0");
19528
19528
  let c = "";
19529
19529
  switch (n) {
@@ -19538,6 +19538,18 @@ function F1(e, n = "dmy", t = ".") {
19538
19538
  }
19539
19539
  return c;
19540
19540
  }
19541
+ function Mk(e, n = "24") {
19542
+ const [t, a] = e.split(":");
19543
+ let i = parseInt(t, 10);
19544
+ if (n === "12") {
19545
+ const o = i >= 12 ? "pm" : "am";
19546
+ return i = i % 12 || 12, `${i}:${a} ${o}`;
19547
+ } else {
19548
+ if (n === "24")
19549
+ return `${i.toString().padStart(2, "0")}:${a}`;
19550
+ throw new Error("invalid format for function 'formatTime' specified. Use '12' or '24'.");
19551
+ }
19552
+ }
19541
19553
  const D1 = {
19542
19554
  data() {
19543
19555
  return {
@@ -23370,7 +23382,7 @@ function kk(e, n, t, a, i, o) {
23370
23382
  [Io]
23371
23383
  ]);
23372
23384
  }
23373
- const Mk = /* @__PURE__ */ P(A1, [["render", kk]]), Pk = {
23385
+ const Pk = /* @__PURE__ */ P(A1, [["render", kk]]), Vk = {
23374
23386
  // el = real dom-element
23375
23387
  mounted(e) {
23376
23388
  if (e.tagName === "INPUT" || e.tagName === "SELECT" || e.tagName === "TEXTAREA" || e.tagName === "A")
@@ -23380,7 +23392,7 @@ const Mk = /* @__PURE__ */ P(A1, [["render", kk]]), Pk = {
23380
23392
  n ? n.focus() : console.warn("No input-element for focus-directive on element " + e.tagName + " found!");
23381
23393
  }
23382
23394
  }
23383
- }, Vk = {
23395
+ }, Ak = {
23384
23396
  // el = real dom-element
23385
23397
  // binding.value = value of v-directive
23386
23398
  mounted(e, n) {
@@ -23408,7 +23420,7 @@ function Tk(e) {
23408
23420
  }
23409
23421
  n.length > 0 && _o(n);
23410
23422
  }
23411
- const Ak = (e) => {
23423
+ const Ek = (e) => {
23412
23424
  const n = e.querySelectorAll(".fancybox");
23413
23425
  _o(n), dt == null || dt.disconnect(), dt.observe(e, {
23414
23426
  subtree: !0,
@@ -23420,13 +23432,13 @@ const Ak = (e) => {
23420
23432
  characterData: !1
23421
23433
  });
23422
23434
  };
23423
- function Ek(e) {
23435
+ function Hk(e) {
23424
23436
  return e ? e.slice(0, 1).toUpperCase() + e.slice(1) : "";
23425
23437
  }
23426
- function Hk(e) {
23438
+ function qk(e) {
23427
23439
  return e ? e.charAt(0).toLowerCase() + e.slice(1) : "";
23428
23440
  }
23429
- function qk(e, n = null, t) {
23441
+ function Rk(e, n = null, t) {
23430
23442
  let a = "";
23431
23443
  return a += e + " ", n && (a += n + " "), a += t, a;
23432
23444
  }
@@ -23450,7 +23462,7 @@ function Lk(e, n) {
23450
23462
  }).forEach((a) => n.push(a));
23451
23463
  }
23452
23464
  }
23453
- function Rk(e, n = 0) {
23465
+ function Nk(e, n = 0) {
23454
23466
  const t = [], a = qo({
23455
23467
  activeItem: n,
23456
23468
  reset() {
@@ -23467,7 +23479,7 @@ function Rk(e, n = 0) {
23467
23479
  }
23468
23480
  }), a;
23469
23481
  }
23470
- function Nk() {
23482
+ function jk() {
23471
23483
  const e = {};
23472
23484
  Ro(a);
23473
23485
  function n(i = "defaultSequence") {
@@ -23534,26 +23546,27 @@ export {
23534
23546
  Si as CmdTooltip,
23535
23547
  Ex as CmdUploadForm,
23536
23548
  yo as CmdWidthLimitationWrapper,
23537
- Mk as ComponentLibrary,
23549
+ Pk as ComponentLibrary,
23538
23550
  i1 as ContactInformation,
23539
- Ak as DirFancybox,
23540
- Pk as DirFocus,
23541
- Vk as DirTelephone,
23551
+ Ek as DirFancybox,
23552
+ Vk as DirFocus,
23553
+ Ak as DirTelephone,
23542
23554
  He as EditComponentWrapper,
23543
23555
  me as I18n,
23544
23556
  Yx as MultipleBoxWrapper,
23545
23557
  Xx as MultipleListsOfLinks,
23546
- Ek as capitalizeFirstLetter,
23558
+ Hk as capitalizeFirstLetter,
23547
23559
  Oi as createHtmlId,
23548
23560
  Qe as createUuid,
23549
23561
  Dk as currentDate,
23550
23562
  F1 as formatDate,
23551
- qk as fullName,
23563
+ Mk as formatTime,
23564
+ Rk as fullName,
23552
23565
  qi as getCookieDisclaimerCookie,
23553
23566
  Ke as getFileExtension,
23554
- Hk as lowercaseFirstLetter,
23567
+ qk as lowercaseFirstLetter,
23555
23568
  be as openFancyBox,
23556
23569
  Cm as setCookieDisclaimerCookie,
23557
- Rk as useScrollspy,
23558
- Nk as useSequence
23570
+ Nk as useScrollspy,
23571
+ jk as useSequence
23559
23572
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "4.1.87",
3
+ "version": "4.1.88",
4
4
  "license": "GPL-3.0-only",
5
5
  "author": "CoManD-UI",
6
6
  "private": false,
package/src/index.js CHANGED
@@ -69,7 +69,7 @@ export { getFileExtension } from '@/utils/getFileExtension'
69
69
  export { capitalizeFirstLetter, lowercaseFirstLetter, fullName } from '@/utils/string'
70
70
  export { useScrollspy } from '@/composables/scrollspy'
71
71
  export { setCookieDisclaimerCookie, getCookieDisclaimerCookie } from '@/utils/cookie'
72
- export { currentDate, formatDate } from "@/utils/date"
72
+ export { currentDate, formatDate, formatTime } from "@/utils/date"
73
73
 
74
74
  // export composables
75
75
  export { useSequence } from '@/composables/sequence'
package/src/utils/date.js CHANGED
@@ -16,12 +16,12 @@ function getDate(inputDate, operator = "+", days = 1) {
16
16
  return date
17
17
  }
18
18
 
19
- function formatDate(inputDate, format = "dmy", separator=".") {
19
+ function formatDate(inputDate, format = "dmy", separator= ".") {
20
20
  // Ensure the input is a valid date object or string
21
21
  const date = new Date(inputDate);
22
22
 
23
23
  if (isNaN(date)) {
24
- console.error("function formatDate received an invalid date as parameter. Provide date in format YYYY-MM-DD");
24
+ console.error("function 'formatDate' received an invalid date as parameter. Provide date in format YYYY-MM-DD");
25
25
  }
26
26
 
27
27
  const year = date.getFullYear();
@@ -43,4 +43,20 @@ function formatDate(inputDate, format = "dmy", separator=".") {
43
43
  return dateFormated
44
44
  }
45
45
 
46
- export {currentDate, formatDate}
46
+ function formatTime(timeString, format = '24') {
47
+ const [hourString, minute] = timeString.split(':');
48
+ let hour = parseInt(hourString, 10);
49
+
50
+ if (format === '12') {
51
+ const ampm = hour >= 12 ? 'pm' : 'am';
52
+ hour = hour % 12 || 12; // Convert 0 to 12 for 12 AM
53
+ return `${hour}:${minute} ${ampm}`;
54
+ } else if (format === '24') {
55
+ const paddedHour = hour.toString().padStart(2, '0');
56
+ return `${paddedHour}:${minute}`;
57
+ } else {
58
+ throw new Error("invalid format for function 'formatTime' specified. Use '12' or '24'.");
59
+ }
60
+ }
61
+
62
+ export {currentDate, formatDate, formatTime}