pukaad-ui-lib 1.89.0 → 1.90.0

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.89.0",
4
+ "version": "1.90.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -81,7 +81,7 @@ const module$1 = defineNuxtModule({
81
81
  addPlugin(resolver.resolve("./runtime/plugins/loadingPage"));
82
82
  addPlugin(resolver.resolve("./runtime/plugins/alert"));
83
83
  addPlugin(resolver.resolve("./runtime/plugins/toast"));
84
- addPlugin(resolver.resolve("./runtime/plugins/convert"));
84
+ addPlugin(resolver.resolve("./runtime/plugins/convert.client"));
85
85
  addPlugin(resolver.resolve("./runtime/plugins/quill.client"));
86
86
  _nuxt.hook("nitro:config", (nitroConfig) => {
87
87
  nitroConfig.publicAssets ||= [];
@@ -1,5 +1,6 @@
1
- import "dayjs/locale/th";
2
1
  export declare class Convert {
2
+ private dayjs;
3
+ constructor(djs: typeof import("dayjs").default);
3
4
  /**
4
5
  * Convert date to Thai Buddhist Era
5
6
  * @example convertDate("2026-01-20") => "20 มกราคม 2569"
@@ -1,18 +1,17 @@
1
1
  import { defineNuxtPlugin } from "nuxt/app";
2
- import dayjs from "dayjs";
3
- import * as buddhistEraPlugin from "dayjs/plugin/buddhistEra";
4
- import "dayjs/locale/th";
5
- const buddhistEra = buddhistEraPlugin.default || buddhistEraPlugin;
6
- dayjs.extend(buddhistEra);
7
- dayjs.locale("th");
2
+ let dayjsInstance;
8
3
  export class Convert {
4
+ dayjs;
5
+ constructor(djs) {
6
+ this.dayjs = djs;
7
+ }
9
8
  /**
10
9
  * Convert date to Thai Buddhist Era
11
10
  * @example convertDate("2026-01-20") => "20 มกราคม 2569"
12
11
  */
13
12
  convertDate(date) {
14
13
  if (!date) return "-";
15
- const d = dayjs(date);
14
+ const d = this.dayjs(date);
16
15
  if (!d.isValid()) return "-";
17
16
  return d.format("D MMMM BBBB");
18
17
  }
@@ -22,7 +21,7 @@ export class Convert {
22
21
  */
23
22
  convertDateTime(date) {
24
23
  if (!date) return "-";
25
- const d = dayjs(date);
24
+ const d = this.dayjs(date);
26
25
  if (!d.isValid()) return "-";
27
26
  return d.format("D MMMM BBBB, HH:mm \u0E19.");
28
27
  }
@@ -32,7 +31,7 @@ export class Convert {
32
31
  */
33
32
  convertShortDate(date) {
34
33
  if (!date) return "-";
35
- const d = dayjs(date);
34
+ const d = this.dayjs(date);
36
35
  if (!d.isValid()) return "-";
37
36
  return d.format("DD/MM/BB");
38
37
  }
@@ -42,7 +41,7 @@ export class Convert {
42
41
  */
43
42
  convertTime(date) {
44
43
  if (!date) return "-";
45
- const d = dayjs(date);
44
+ const d = this.dayjs(date);
46
45
  if (!d.isValid()) return "-";
47
46
  return d.format("HH:mm \u0E19.");
48
47
  }
@@ -70,10 +69,15 @@ export class Convert {
70
69
  return num.toString();
71
70
  }
72
71
  }
73
- export default defineNuxtPlugin(() => {
72
+ export default defineNuxtPlugin(async () => {
73
+ const dayjs = (await import("dayjs")).default;
74
+ const buddhistEra = (await import("dayjs/plugin/buddhistEra")).default;
75
+ const localeTh = (await import("dayjs/locale/th")).default;
76
+ dayjs.extend(buddhistEra);
77
+ dayjs.locale("th");
74
78
  return {
75
79
  provide: {
76
- convert: new Convert()
80
+ convert: new Convert(dayjs)
77
81
  }
78
82
  };
79
83
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.89.0",
3
+ "version": "1.90.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",