@fy-/fws-vue 1.6.5 → 1.6.7
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/components/ui/DefaultInput.vue +13 -14
- package/package.json +1 -1
|
@@ -54,6 +54,18 @@ const props = withDefaults(
|
|
|
54
54
|
dpOptions: () => ({}),
|
|
55
55
|
},
|
|
56
56
|
);
|
|
57
|
+
const disableDatesAdult = (date: Date) => {
|
|
58
|
+
if (!props.disableDatesUnder18) return false;
|
|
59
|
+
const today = new Date();
|
|
60
|
+
const date18YearsAgo = new Date(
|
|
61
|
+
today.getFullYear() - 18,
|
|
62
|
+
today.getMonth(),
|
|
63
|
+
today.getDate(),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return date < date18YearsAgo;
|
|
67
|
+
};
|
|
68
|
+
|
|
57
69
|
const translate = useTranslation();
|
|
58
70
|
const inputRef = ref<HTMLInputElement>();
|
|
59
71
|
const errorProps = toRef(props, "error");
|
|
@@ -105,17 +117,6 @@ const modelCheckbox = computed({
|
|
|
105
117
|
},
|
|
106
118
|
});
|
|
107
119
|
defineExpose({ focus, blur, getInputRef });
|
|
108
|
-
|
|
109
|
-
function disableDateUnder18Func(date: Date) {
|
|
110
|
-
const today = new Date();
|
|
111
|
-
const date18YearsAgo = new Date(
|
|
112
|
-
today.getFullYear() - 18,
|
|
113
|
-
today.getMonth(),
|
|
114
|
-
today.getDate(),
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
return date < date18YearsAgo;
|
|
118
|
-
}
|
|
119
120
|
</script>
|
|
120
121
|
<template>
|
|
121
122
|
<div>
|
|
@@ -207,15 +208,13 @@ function disableDateUnder18Func(date: Date) {
|
|
|
207
208
|
<!-- @vue-skip -->
|
|
208
209
|
<VueTailwindDatepicker
|
|
209
210
|
v-model="model"
|
|
211
|
+
:disable-date="disableDatesAdult"
|
|
210
212
|
:formatter="{
|
|
211
213
|
date: 'YYYY-MM-DD',
|
|
212
214
|
month: 'MMM',
|
|
213
215
|
}"
|
|
214
216
|
:placeholder="placeholder"
|
|
215
217
|
as-single
|
|
216
|
-
:disable-date="
|
|
217
|
-
props.disableDatesUnder18 ? disableDateUnder18Func : undefined
|
|
218
|
-
"
|
|
219
218
|
></VueTailwindDatepicker>
|
|
220
219
|
</div>
|
|
221
220
|
</div>
|