ant-design / ant-design/pro-components

🐛[BUG] 弹窗表单, RangePicker不能给初始值. 给了以后就报错

Open
#8,399 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

上次遇到该问题#8293, 按照大佬指示填单价参数dateFormatter={false}
### 尝试解决问题
`npm cache clean --force`
`npm install`

### 🐛 bug 描述
不给初始值, 就没有问题. 给了以后就会报错
```
const initValues: FormProps = {
...current,
dateRange: [
dayjs("2023/01/01"),
dayjs("2023/01/02"),
]
}


initialValues={initValues}
dateFormatter={false}
onFinish={async (values) => {
console.log(values)
console.log(values.dateRange[0].format("YYYY-MM-DD"))
}}
>




```
### 📷 复现步骤
无法复现, 本地始终不行,沙箱环境没有问题
https://codesandbox.io/p/sandbox/antd-rangepicker-hrpfgh?file=%2Fsrc%2FApp.tsx%3A18%2C82

### 💻 复现代码
无法复现

### 🚑 其他信息

![1715249230511](https://github.com/ant-design/pro-components/assets/12420958/9cffbaf3-5631-43eb-bbc4-24afc69eb78c)
![image](https://github.com/ant-design/pro-components/assets/12420958/cc290fc8-35ec-4ac9-9619-048d0a8fce06)
![image](https://github.com/ant-design/pro-components/assets/12420958/c42e817e-9ce1-458b-b0d4-7645ed6a3427)
![image](https://github.com/ant-design/pro-components/assets/12420958/256ec202-a327-4144-98a8-c2601cfa029c)

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox and the reported DrawerForm, Form.Item, and RangePicker setup using initialValues and dateFormatter={false}. First determine why the issue cannot be reproduced locally, then confirm whether the error occurs with the supplied dateRange values; done means the initial range works without the reported error and the behavior is covered by a reproducible case.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.