fix presentMax

This commit is contained in:
philipp lang 2024-06-16 23:24:25 +02:00
parent 58c3616a30
commit bc4cec48e4
1 changed files with 17 additions and 5 deletions

View File

@ -5,7 +5,7 @@
v-model="inner"
:name="name"
:min="min"
:max="max"
:max="presentMax"
:type="type"
placeholder=""
class="bg-white group-[.info]:bg-blue-200 rounded-lg focus:outline-none text-gray-600 text-left w-full py-1 @sm:py-2 @sm:group-[.info]:py-1 px-2 @sm:px-3 @sm:group-[.info]:px-2 text-sm @sm:text-base @sm:group-[.info]:text-sm"
@ -44,8 +44,12 @@ const props = defineProps({
type: String,
},
min: {
type: String,
default: () => '',
type: Number,
default: () => undefined,
},
max: {
type: Number,
default: () => undefined,
},
label: {
required: true,
@ -68,8 +72,16 @@ const props = defineProps({
},
});
const max = computed(() => {
return props.maxToday ? dayjs().format('YYYY-MM-DD') : null;
const presentMax = computed(() => {
if (props.type === 'date' && props.maxToday) {
return dayjs().format('YYYY-MM-DD');
}
if (props.type === 'number') {
return props.max;
}
return null;
});
const inner = computed({