fix: future birth date

This commit is contained in:
puriphatt 2024-07-16 03:23:45 +00:00
parent 608f84b0df
commit 204a854a1c
2 changed files with 35 additions and 5 deletions

View file

@ -1,9 +1,11 @@
<script setup lang="ts">
import useUserStore from 'src/stores/user';
import useOptionStore from 'src/stores/options';
import { dateFormat } from 'src/utils/datetime';
import {
dateFormat,
calculateAge,
disabledAfterToday,
} from 'src/utils/datetime';
const userStore = useUserStore();
const optionStore = useOptionStore();
const firstName = defineModel<string>('firstName');
@ -13,7 +15,7 @@ const lastNameEN = defineModel<string>('lastNameEN');
const telephoneNo = defineModel<string>('telephoneNo');
const email = defineModel<string>('email');
const gender = defineModel<string>('gender');
const birthDate = defineModel<Date | null>('birthDate');
const birthDate = defineModel<Date | string | null>('birthDate');
const nationality = defineModel<string>('nationality');
defineProps<{
@ -123,6 +125,7 @@ defineProps<{
utc
autoApply
v-model="birthDate"
:disabled-dates="disabledAfterToday"
:teleport="true"
:dark="$q.dark.isActive"
:locale="$i18n.locale === 'th-th' ? 'th' : 'en'"
@ -168,7 +171,7 @@ defineProps<{
readonly
:label="$t('formDialogInputAge')"
class="col-3"
:model-value="birthDate ? userStore.calculateAge(birthDate) : ''"
:model-value="birthDate ? calculateAge(birthDate) : ''"
/>
<q-select
v-if="employee"