I am using element ui datepicker from there. I want to disable past dates.
<el-date-picker
v-model="form.startDate"
type="date"
placeholder="Tarih Seçiniz."
style="width: 100%"
/>
Can you help me to handle this issue?
I am using element ui datepicker from there. I want to disable past dates.
<el-date-picker
v-model="form.startDate"
type="date"
placeholder="Tarih Seçiniz."
style="width: 100%"
/>
Can you help me to handle this issue?
You can achieve this by adding a :disabled-date attribute in the <el-date-picker> element and pass the boolean value to this attribute based on the calculation.
<el-date-picker :disabled-date="disabledDate" ...
In Script:
const disabledDate = (time: Date) => {
const date = new Date();
const previousDate = date.setDate(date.getDate() - 1);
return time.getTime() < previousDate;
}