y200subcontrols 0.0.328 → 0.0.330
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.
|
@@ -18,17 +18,17 @@ let _value = "";
|
|
|
18
18
|
function padZero(num) {
|
|
19
19
|
return num > 9 ? `${num}` : `0${num}`;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
if (typeof
|
|
24
|
-
|
|
21
|
+
function setValueInternal(value2) {
|
|
22
|
+
if (value2) {
|
|
23
|
+
if (typeof value2 === "string") {
|
|
24
|
+
value2 = new Date(value2);
|
|
25
25
|
}
|
|
26
|
-
const year =
|
|
27
|
-
const month =
|
|
28
|
-
const day =
|
|
29
|
-
const hour = padZero(
|
|
30
|
-
const minute = padZero(
|
|
31
|
-
const second = padZero(
|
|
26
|
+
const year = value2.getFullYear();
|
|
27
|
+
const month = value2.getMonth() + 1;
|
|
28
|
+
const day = value2.getDate();
|
|
29
|
+
const hour = padZero(value2.getHours());
|
|
30
|
+
const minute = padZero(value2.getMinutes());
|
|
31
|
+
const second = padZero(value2.getSeconds());
|
|
32
32
|
_value = `${year}-${padZero(month)}-${padZero(day)}T${hour}:${minute}:${second}`;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -42,7 +42,6 @@ function validateElement(event) {
|
|
|
42
42
|
isValid = input.checkValidity();
|
|
43
43
|
if (input.type === "number") {
|
|
44
44
|
console.clear();
|
|
45
|
-
console.log(value, isValid);
|
|
46
45
|
}
|
|
47
46
|
dispatch("validated", isValid);
|
|
48
47
|
}
|
|
@@ -56,7 +55,6 @@ function handleChange(event) {
|
|
|
56
55
|
});
|
|
57
56
|
return;
|
|
58
57
|
}
|
|
59
|
-
console.log(_value);
|
|
60
58
|
const parts = _value.split("T");
|
|
61
59
|
const datePart = parts[0].split("-");
|
|
62
60
|
const year = Number(datePart[0]);
|
|
@@ -76,6 +74,7 @@ onMount(() => {
|
|
|
76
74
|
let r = (Math.random() + 1).toString(36).substring(2);
|
|
77
75
|
id = `input${r}`;
|
|
78
76
|
}
|
|
77
|
+
setValueInternal(value);
|
|
79
78
|
});
|
|
80
79
|
</script>
|
|
81
80
|
|
|
@@ -50,7 +50,7 @@ onMount(() => {
|
|
|
50
50
|
}
|
|
51
51
|
let elem = inputContainer.querySelector('[data-input="true"]');
|
|
52
52
|
if (elem) {
|
|
53
|
-
elem.dataset.requiresValidation = "true";
|
|
53
|
+
elem.dataset.requiresValidation = required ? "true" : "false";
|
|
54
54
|
input = elem;
|
|
55
55
|
elem.addEventListener("change", validateElement);
|
|
56
56
|
elem.addEventListener("validate--custom", validateElement);
|