ant-design-vue
ant-design-vue copied to clipboard
In DatePicker week mode, if the valueFormat parameter is specified, the displayed value is abnormal
- [ ] I have searched the issues of this repository and believe that this is not a duplicate.
Version
3.2.6
Environment
ant design vue 3.2.10
Reproduction link
Steps to reproduce
尝试过引入 import advancedFormat from 'dayjs/plugin/advancedFormat' import weekOfYear from 'dayjs/plugin/weekOfYear' 等方式均不能成功
What is expected?
使用valueFormat能够正常显示值
What is actually happening?
change时获取到的值正常,显示的值为当年第一周
dayjs不支持dayjs('2022-33', 'YYYY-ww')
https://github.com/vueComponent/ant-design-vue/blob/7473233bc95b587232afed64c3d5ef8269fb8023/components/date-picker/generatePicker/generateSinglePicker.tsx#L80 https://github.com/vueComponent/ant-design-vue/blob/7473233bc95b587232afed64c3d5ef8269fb8023/components/date-picker/generatePicker/generateSinglePicker.tsx#L81
maybeToString 在有valueFormat的情况下会将value转为string,而value的类型又是Dayjs,导致更新错误。这边如果采用的是emit('update:value', data)就没问题。 现阶段的话可以不使用双向绑定,在onchange事件中取format过的值。 感觉使用valueFormat的话再使用v-modal是不是有点矛盾。 @atom-git @tangjinzhou @gp0119
dayjs不支持
dayjs('2022-33', 'YYYY-ww')
通过引入插件是支持的 import advancedFormat from 'dayjs/plugin/advancedFormat' import weekOfYear from 'dayjs/plugin/weekOfYear'