@nr1e/qwik-ui 1.0.2 → 1.0.3

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.
@@ -2,7 +2,19 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
- const lang = require("@nr1e/commons/lang");
5
+ function formatDateTime(date, timeZone, locale) {
6
+ const dateObj = typeof date === "string" ? new Date(date) : date;
7
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
8
+ timeZone,
9
+ year: "numeric",
10
+ month: "long",
11
+ day: "numeric",
12
+ hour: "numeric",
13
+ minute: "2-digit",
14
+ hour12: true,
15
+ timeZoneName: "short"
16
+ }).format(dateObj);
17
+ }
6
18
  const FormatDateTime = qwik.component$((props) => {
7
19
  const date = qwik.useSignal(null);
8
20
  if (!props.date) return null;
@@ -15,7 +27,7 @@ const FormatDateTime = qwik.component$((props) => {
15
27
  timeZone = null;
16
28
  }
17
29
  }
18
- date.value = lang.formatTimeZoneDateTimeReadable(props.date, timeZone ?? void 0, props.locale ?? void 0);
30
+ date.value = formatDateTime(props.date, timeZone ?? void 0, props.locale ?? void 0);
19
31
  }
20
32
  });
21
33
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
@@ -1,6 +1,18 @@
1
1
  import { jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, useSignal, useVisibleTask$ } from "@builder.io/qwik";
3
- import { formatTimeZoneDateTimeReadable } from "@nr1e/commons/lang";
3
+ function formatDateTime(date, timeZone, locale) {
4
+ const dateObj = typeof date === "string" ? new Date(date) : date;
5
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
6
+ timeZone,
7
+ year: "numeric",
8
+ month: "long",
9
+ day: "numeric",
10
+ hour: "numeric",
11
+ minute: "2-digit",
12
+ hour12: true,
13
+ timeZoneName: "short"
14
+ }).format(dateObj);
15
+ }
4
16
  const FormatDateTime = component$((props) => {
5
17
  const date = useSignal(null);
6
18
  if (!props.date) return null;
@@ -13,7 +25,7 @@ const FormatDateTime = component$((props) => {
13
25
  timeZone = null;
14
26
  }
15
27
  }
16
- date.value = formatTimeZoneDateTimeReadable(props.date, timeZone ?? void 0, props.locale ?? void 0);
28
+ date.value = formatDateTime(props.date, timeZone ?? void 0, props.locale ?? void 0);
17
29
  }
18
30
  });
19
31
  return /* @__PURE__ */ jsx(Fragment, {
@@ -2,7 +2,15 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
- const lang = require("@nr1e/commons/lang");
5
+ function formatDate(date, timeZone, locale) {
6
+ const dateObj = typeof date === "string" ? new Date(date) : date;
7
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
8
+ timeZone,
9
+ year: "numeric",
10
+ month: "short",
11
+ day: "numeric"
12
+ }).format(dateObj);
13
+ }
6
14
  const FormatDate = qwik.component$((props) => {
7
15
  const date = qwik.useSignal(null);
8
16
  if (!props.date) return null;
@@ -15,7 +23,7 @@ const FormatDate = qwik.component$((props) => {
15
23
  timeZone = null;
16
24
  }
17
25
  }
18
- date.value = lang.formatTimeZoneDateShort(props.date, timeZone ?? void 0, props.locale ?? void 0);
26
+ date.value = formatDate(props.date, timeZone ?? void 0, props.locale ?? void 0);
19
27
  }
20
28
  });
21
29
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
@@ -1,6 +1,14 @@
1
1
  import { jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, useSignal, useVisibleTask$ } from "@builder.io/qwik";
3
- import { formatTimeZoneDateShort } from "@nr1e/commons/lang";
3
+ function formatDate(date, timeZone, locale) {
4
+ const dateObj = typeof date === "string" ? new Date(date) : date;
5
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
6
+ timeZone,
7
+ year: "numeric",
8
+ month: "short",
9
+ day: "numeric"
10
+ }).format(dateObj);
11
+ }
4
12
  const FormatDate = component$((props) => {
5
13
  const date = useSignal(null);
6
14
  if (!props.date) return null;
@@ -13,7 +21,7 @@ const FormatDate = component$((props) => {
13
21
  timeZone = null;
14
22
  }
15
23
  }
16
- date.value = formatTimeZoneDateShort(props.date, timeZone ?? void 0, props.locale ?? void 0);
24
+ date.value = formatDate(props.date, timeZone ?? void 0, props.locale ?? void 0);
17
25
  }
18
26
  });
19
27
  return /* @__PURE__ */ jsx(Fragment, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nr1e/qwik-ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "NR1E Qwik UI Library",
5
5
  "author": "NR1E, Inc.",
6
6
  "publishConfig": {
@@ -36,8 +36,7 @@
36
36
  "peerDependencies": {
37
37
  "@builder.io/qwik-city": "1.19.0",
38
38
  "tailwindcss-animated": "2.0.0",
39
- "@nr1e/qwik-icons": "0.0.25",
40
- "@nr1e/commons": "0.4.3"
39
+ "@nr1e/qwik-icons": "0.0.25"
41
40
  },
42
41
  "devDependencies": {
43
42
  "@builder.io/qwik": "1.19.0",