解决element时间选择器el-date-picker赋值无效解决方式

value-format设定格式是 YYYY/M/D ,那么月份和日期分别是1-12、1-31

<el-date-picker
       v-model="operateDate"
       type="daterange"
       range-separator="To"
       start-placeholder="Start date"
       end-placeholder="End date"
       editable
       value-format="YYYY/M/D"
/>
this.operateDate = ["2022/1/1", "2022/1/31"];

如果格式是 YYYY/MM/DD ,那么月份和日期分别是01-12、01-31

<el-date-picker
       v-model="operateDate"
       type="daterange"
       range-separator="To"
       start-placeholder="Start date"
       end-placeholder="End date"
       editable
       value-format="YYYY/MM/DD"
/>

赋值

//
this.operateDate = ["2022/05/01", "2022/05/31"];

List of all available formats

FormatOutputDescription
YY18Two-digit year
YYYY2018Four-digit year
M1-12The month, beginning at 1
MM01-12The month, 2-digits
MMMJan-DecThe abbreviated month name
MMMMJanuary-DecemberThe full month name
D1-31The day of the month
DD01-31The day of the month, 2-digits
d0-6The day of the week, with Sunday as 0
ddSu-SaThe min name of the day of the week
dddSun-SatThe short name of the day of the week
ddddSunday-SaturdayThe name of the day of the week
H0-23The hour
HH00-23The hour, 2-digits
h1-12The hour, 12-hour clock
hh01-12The hour, 12-hour clock, 2-digits
m0-59The minute
mm00-59The minute, 2-digits
s0-59The second
ss00-59The second, 2-digits
SSS000-999The millisecond, 3-digits
Z+05:00The offset from UTC, ±HH:mm
ZZ+0500The offset from UTC, ±HHmm
AAM PM
aam pm
......Other formats ( dependent AdvancedFormat plugin )

日期格式化参考:
https://day.js.org/docs/en/display/format

GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45 8 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 8 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐