[Vuejs]-VueJs – Element UI: How to set el-date-picker that make it no earlier than today

0👍

Use de disabledDate method

<el-form-item label="choose date">
        <el-date-picker
            v-model="timeArray"
            type="datetimerange"
            start-placeholder="startTime"
            end-placeholder="endTime"
            :default-time="defaultTime"
            :disabled-date="disabledDate"
        >
        </el-date-picker>
</el-form-item>
data() {
    return {
      defaultTime: [
        new Date(2021, 1, 1, 12, 0, 0),
        new Date(2021, 2, 1, 12, 0, 0)
      ],
      disabledDate(time) {
        return time.getTime() <= Date.now()
      },
    }
}

Leave a comment