y200subcontrols 0.0.355 → 0.0.357

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.
@@ -6,7 +6,7 @@ $: {
6
6
  if (typeof date === "string") {
7
7
  date = new Date(date);
8
8
  }
9
- dateFormatted = formatDateTime(date);
9
+ dateFormatted = formatDateTime(date, showTimeStamp);
10
10
  }
11
11
  </script>
12
12
 
@@ -6,7 +6,6 @@
6
6
  <slot name="header" />
7
7
  </div>
8
8
  <div data-tab-page="true" data-index={index} class="transition-all ease-in-out duration-500 opacity-0">
9
- <slot />
10
- {index}
9
+ <slot />
11
10
  </div>
12
11
  </div>
@@ -1 +1 @@
1
- export declare function formatDateTime(dateTime: Date, showTimeStamp?: boolean): string;
1
+ export declare function formatDateTime(dateTime: Date | undefined | string, showTimeStamp?: boolean, timeStyle?: "full" | "long" | "medium" | "short" | undefined, dateStyle?: "full" | "long" | "medium" | "short" | undefined): string;
@@ -1,9 +1,16 @@
1
- export function formatDateTime(dateTime, showTimeStamp = false) {
1
+ export function formatDateTime(dateTime, showTimeStamp = false, timeStyle = 'short', dateStyle = 'short') {
2
+ if (!dateTime) {
3
+ return 'N/A';
4
+ }
5
+ if (typeof dateTime === 'string') {
6
+ dateTime = new Date(dateTime);
7
+ }
8
+ timeStyle ??= 'short';
2
9
  let dateFormatted = 'N/A';
3
10
  if (dateTime) {
4
11
  const formatter = new Intl.DateTimeFormat(undefined, {
5
- dateStyle: 'short',
6
- timeStyle: showTimeStamp ? 'short' : undefined
12
+ dateStyle: dateStyle,
13
+ timeStyle: showTimeStamp ? timeStyle : undefined
7
14
  });
8
15
  dateFormatted = formatter.format(dateTime);
9
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "y200subcontrols",
3
- "version": "0.0.355",
3
+ "version": "0.0.357",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
@@ -55,6 +55,6 @@
55
55
  "license": "MIT",
56
56
  "dependencies": {
57
57
  "bootstrap-icons": "^1.11.3",
58
- "y200subcontrols": "0.0.3549"
58
+ "y200subcontrols": "^0.0.355"
59
59
  }
60
60
  }