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.
package/dist/date-utils.d.ts
CHANGED
|
@@ -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;
|
package/dist/date-utils.js
CHANGED
|
@@ -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:
|
|
6
|
-
timeStyle: showTimeStamp ?
|
|
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.
|
|
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.
|
|
58
|
+
"y200subcontrols": "^0.0.355"
|
|
59
59
|
}
|
|
60
60
|
}
|