@fy-/fws-vue 1.6.4 → 1.6.6

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.
@@ -234,7 +234,6 @@ function selectFile(e: Event) {
234
234
  v-model="state.userData.Birthdate"
235
235
  class="mb-4"
236
236
  type="datepicker"
237
- :disableDatesUnder18="true"
238
237
  :label="$t('fws_birthdate_label')"
239
238
  :error-vuelidate="v$.userData.Birthdate.$errors"
240
239
  />
@@ -139,7 +139,6 @@ const patchUser = async () => {
139
139
  id="birthdateFWS"
140
140
  v-model="state.userData.Birthdate"
141
141
  class="mb-4"
142
- :disableDatesUnder18="true"
143
142
  type="datepicker"
144
143
  :label="$t('fws_birthdate_label')"
145
144
  :error-vuelidate="v$.userData.Birthdate.$errors"
@@ -105,12 +105,16 @@ const modelCheckbox = computed({
105
105
  },
106
106
  });
107
107
  defineExpose({ focus, blur, getInputRef });
108
+
108
109
  function disableDateUnder18Func(date: Date) {
109
- if (!props.disableDatesUnder18) return false;
110
- const now = new Date();
111
- const age = now.getFullYear() - date.getFullYear();
112
- if (age < 18) return true;
113
- return false;
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;
114
118
  }
115
119
  </script>
116
120
  <template>
@@ -210,7 +214,7 @@ function disableDateUnder18Func(date: Date) {
210
214
  :placeholder="placeholder"
211
215
  as-single
212
216
  :disable-date="
213
- disableDatesUnder18 ? disableDateUnder18Func : undefined
217
+ props.disableDatesUnder18 ? disableDateUnder18Func : undefined
214
218
  "
215
219
  ></VueTailwindDatepicker>
216
220
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {