ant-design-vue
ant-design-vue copied to clipboard
datepicker使用valueFormat指定格式时,对带有中括号[]的格式字符出现匹配错误的bug
trafficstars
- [ ] I have searched the issues of this repository and believe that this is not a duplicate.
Version
4.2.1
Environment
window10, edge124.0.2478.97, vue3.4.21
Reproduction link
https://github.com/vueComponent/ant-design-vue/blob/main/components/vc-picker/generate/dayjs.ts
Steps to reproduce
可以尝试在datepicker中使用任意一个picker类型, 然后在valueFormat中设置带有[]的格式字符, 如YYYY-[Q]Q
What is expected?
中括号是dayjs中指定的原字符返回用法,请修正这一问题。
What is actually happening?
在使用中括号的格式字符时,会出现报错信息,断点查找问题时,发现是中括号[]导致匹配字符时与实际值的长度不一致,如值为2024-Q3,valueFormat为YYYY-[Q]Q,这时valueFormat就会比值多出两个长度,导致在匹配时为空字符。