The problem of wrong selection time of elementUI datePicker components

You can use

when

is written in the following style

 <el-form-item label=":" label-width="70px">
          <el-date-picker
            v-model="form.startTime"
            type="date"
            :picker-options="startPickerOptions"
            placeholder="">
          </el-date-picker>
          <span class="date-range-seperator"></span>
          <el-date-picker
            v-model="form.endTime"
            type="date"
            :picker-options="endPickerOptions"
            placeholder="">
          </el-date-picker>
        </el-form-item>

but rewrite it as

 <el-form-item label=":" label-width="70px">
          <el-date-picker
            v-model="form.startTime"
            type="datetime"
            :picker-options="startPickerOptions"
            placeholder="">
          </el-date-picker>
          <span class="date-range-seperator"></span>
          <el-date-picker
            v-model="form.endTime"
            type="datetime"
            :picker-options="endPickerOptions"
            placeholder="">
          </el-date-picker>
        </el-form-item>

when type is changed from date to datetime, there is always an error

.

clipboard.png
I don"t know where the quota is

Mar.10,2021

this is the element-ui documentation is not perfect pot, the user is very uncomfortable, generally can achieve their own, I do not use them, the specific type of acceptance, you need to see the source code analysis. My guess here is that it can only accept one type, which is actually the Date type of javascript. From error:

Cannot read property 'getHours' of undefined

Analysis is easy to obtain.

Menu