@dile/utils 2.7.1 → 2.7.4
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.
|
@@ -9,6 +9,23 @@ function formatToIsoOnlyDate(date) {
|
|
|
9
9
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
function formatIfIso8601(dateStr) {
|
|
13
|
+
const iso8601Regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
14
|
+
|
|
15
|
+
if (!iso8601Regex.test(dateStr)) {
|
|
16
|
+
return dateStr;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const date = new Date(dateStr);
|
|
20
|
+
if (isNaN(date)) {
|
|
21
|
+
return dateStr;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const pad = n => n.toString().padStart(2, '0');
|
|
25
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` +
|
|
26
|
+
`${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
12
29
|
export class DileDatetimepicker extends DileDatepicker {
|
|
13
30
|
|
|
14
31
|
static get styles() {
|
|
@@ -91,4 +108,8 @@ export class DileDatetimepicker extends DileDatepicker {
|
|
|
91
108
|
}
|
|
92
109
|
this.showDate(date);
|
|
93
110
|
}
|
|
111
|
+
|
|
112
|
+
computeValue(value){
|
|
113
|
+
return formatIfIso8601(value);
|
|
114
|
+
}
|
|
94
115
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/utils",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.4",
|
|
4
4
|
"description": "Utility Components of Diverse Uses Based on the Lit Library and Web Components Standard.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://dile-components.com/",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dile/ui": "^2.8.
|
|
23
|
+
"@dile/ui": "^2.8.3",
|
|
24
24
|
"@lion/ui": "^0.11.2",
|
|
25
25
|
"linkify-string": "^4.1.3",
|
|
26
26
|
"linkifyjs": "^4.1.3",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "fbb7a5933a1ea456601ab8af86da1586b1c1a34e"
|
|
33
33
|
}
|