ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

ADatePicker component, when picker=quarter, enter "2022-Q3" in the input box and press Enter cannot be automatically selected

Open xingorg1 opened this issue 3 years ago • 2 comments
trafficstars

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.2.6

Environment

macos 10.15.7, Chrome 101.0.4951.64(正式版本) (x86_64), vue ^3.0

Reproduction link

https://www.antdv.com/components/date-picker-cn#API

Steps to reproduce

打开官网 ADatePicker组件,picker类型为季度时,在输入框输入"2022-Q3"后回车不能自动选中,但是输入“2022-Q1”就是可以的。 通用表现是输入2022Q2~2022Q4就不能自动选中。

What is expected?

期望在季度组件的文本框中输入2022-Q3并回车后,可以自动选中

What is actually happening?

没有选中

xingorg1 avatar Jun 09 '22 10:06 xingorg1

应该源于这个问题:https://github.com/iamkun/dayjs/issues/845 因为这个问题,要做日期自动选中+回显效果,在季度组件就有问题。

如果要想实现季度默认值填充后自动选中,可以将默认值从”2022-Q3“ 改为具体天 ”2022-07-01“的形式。如下

<a-date-picker
  v-model:value="value"
  picker="quarter"
/>
const value = ref<Dayjs>(dayjs('2022-Q3')) // 这样不能选中,转化为无效日期,组件展示”Invalid Date“
const value = ref<Dayjs>(dayjs('2022-08-01'))

xingorg1 avatar Jun 09 '22 10:06 xingorg1

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Aug 09 '22 03:08 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Aug 17 '23 00:08 github-actions[bot]