:is-date-disabled="dateDisabled"
<n-date-picker
v-if="formData.timeEndActive"
type="date"
style="width: 100%"
placeholder="请选择任务结束时间"
value-format="yyyy-MM-dd 23:59:59"
:is-date-disabled="dateDisabled"
v-model:formatted-value="formData.scheduleEndTime"/>
const defaultDate = new Date()
const dateDisabled =(ts:any)=>{
const today = new Date();
today.setHours(0, 0, 0, 0);
const todayTimestamp = today.getTime();
const selectedDate = new Date(ts);
const selectedTimestamp = selectedDate.getTime();
return selectedTimestamp < todayTimestamp;
}
效果如下: