nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.37k stars 853 forks source link

The timepicker is disabled if the v-model for it is set to NULL. #1316

Open rfawesome21 opened 1 year ago

rfawesome21 commented 1 year ago

Screenshot 2023-04-28 at 22 13 31
<template>
    <VDatePicker v-model="time" mode="time" :timezone="timezone">
        <template v-slot="{ inputValue, inputEvents }">
            <div class='relative w-auto label-input' data-cy="date-input-field">
                <input :id="id"
                       class="h-11 w-full"
                       :value="inputValue"
                       v-on="inputEvents"
                       required />
            </div>
        </template>
    </VDatePicker>
</template>

<script>
export default {
    name: "InputTimePicker.vue",
    props: {},
    data() {
        return {
            time: null,
            id: '',
            timezone: 'UTC',
            attrs: [
                {
                    key: 'today',
                    bar: true,
                    dates: new Date(),
                },
            ],
        };
    },
}
</script>
chuchiperriman commented 1 year ago

Same problem here. Any workaround?

noook commented 2 months ago

The culprit is a css rule:

.vc-time-picker.vc-invalid {
    pointer-events: none;
    opacity: 0.5;
}

I believe this is overridable, unsetting pointer-event: none allows using the timepicker but does not seem to update the value. I'm digging and will update this post when I'll find a way

cc @chuchiperriman