|
@@ -53,6 +53,18 @@
|
|
|
- 日期选择器添加清除按钮:`allowClear`
|
|
- 日期选择器添加清除按钮:`allowClear`
|
|
|
- 日期选择器添加占位提示:`placeholder="请选择日期"`
|
|
- 日期选择器添加占位提示:`placeholder="请选择日期"`
|
|
|
- 日期选择器禁用未来日期:`disabledDate={(current) => current && current > dayjs().endOf('day')}`(根据业务需求调整)
|
|
- 日期选择器禁用未来日期:`disabledDate={(current) => current && current > dayjs().endOf('day')}`(根据业务需求调整)
|
|
|
|
|
+- 日期对象规范:始终使用dayjs对象而非原生Date对象,避免出现"isValid is not a function"错误
|
|
|
|
|
+ ```typescript
|
|
|
|
|
+ // 错误示例 - 使用原生Date对象
|
|
|
|
|
+ form.setFieldsValue({
|
|
|
|
|
+ noteDate: new Date(record.noteDate) // 导致验证失败
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 正确示例 - 使用dayjs对象
|
|
|
|
|
+ form.setFieldsValue({
|
|
|
|
|
+ noteDate: dayjs(record.noteDate) // 正常支持验证方法
|
|
|
|
|
+ });
|
|
|
|
|
+ ```
|
|
|
- 日期时间转换规范:
|
|
- 日期时间转换规范:
|
|
|
```typescript
|
|
```typescript
|
|
|
// 日期对象转字符串(提交给后端)
|
|
// 日期对象转字符串(提交给后端)
|