elementUI的time-picker组件报Invalid Date in fecha.format的原因
一, picker-options的selectableRange属性没有写秒,导致格式错误,选择时间将不生效
例如:
错误示例
<el-time-picker
arrow-control
v-model="value2"
:picker-options="{
selectableRange: '18:30 - 20:30'
}"
placeholder="任意时间点">
</el-time-picker>
正确示例
<el-time-picker
arrow-control
v-model="value2"
:picker-options="{
selectableRange: '18:30:00 - 20:30:00'
}"
placeholder="任意时间点">
</el-time-picker>
二, 想要设置时间列表选择只到分钟,如下
正确示例
<el-time-picker
v-model="ruleForm.endHours"
:default-value="ruleForm.endHours"
:size="sizeS"
value-format="HH:mm"
format="HH:mm"
:picker-options="{
selectableRange: '18:30:00 - 20:30:00',
}"
placeholder="请选择"
>
</el-time-picker>
value-format的值用于格式化被选中的值的格式为小时分钟 如: 03:01
format的值是将列表格式为直到分钟的选择