ant-design Date picker quarterly no longer allows user to type in dates v5

uidvcgyl  于 8个月前  发布在  其他
关注(0)|答案(3)|浏览(110)

https://ant.design/components/date-picker

Steps to reproduce

https://ant.design/components/date-picker

In v4 you can type 2020-Q4 to change date

in v5 this no longer works.

What is expected?

When a user types in the quarterly formatted date and then hits enter a change action to occur.

What is actually happening?

Nothing.
| Environment | Info |
| ------------ | ------------ |
| antd | 5.20.0 |
| React | 18 |
| System | mac |
| Browser | Chrome |

This is affecting testing with react test library as well. Generally more tricky to get unit tests to behave as expected for other date picker types. I believe you can still use the original date picker to type in dates, but not for instance weekly or quarterly types.

pxyaymoc

pxyaymoc1#

Seems DayJS not support parse Q as format...

  1. moment('2024-Q2', 'YYYY-[Q]Q').format('YYYY-MM'); // 2024-04
  2. dayjs('2024-Q2', 'YYYY-[Q]Q').format('YYYY-MM'); //'Invalid Date'
lndjwyie

lndjwyie3#

@zombieJ https://day.js.org/docs/en/plugin/advanced-format

This is for format not for parse. Parse use customParseFormat . ref iamkun/dayjs#845

cc @iamkun

相关问题