Commit e689ee5fa6c0d728b2dc83fc98ba7470fd3fa619

Authored by 最后
Committed by GitHub
1 parent f4af2311

Update useFormEvents.ts (#514)

fix: 修复 表单回显时,参数为null或者''时, 报Invalid date的错
src/components/Form/src/hooks/useFormEvents.ts
... ... @@ -67,13 +67,13 @@ export function useFormEvents({
67 67 // time type
68 68 if (itemIsDateType(key)) {
69 69 if (Array.isArray(value)) {
70   - const arr: moment.Moment[] = [];
  70 + const arr: any[] = [];
71 71 for (const ele of value) {
72   - arr.push(dateUtil(ele));
  72 + arr.push(ele ? dateUtil(ele) : null);
73 73 }
74 74 formModel[key] = arr;
75 75 } else {
76   - formModel[key] = dateUtil(value);
  76 + formModel[key] = value ? dateUtil(value) : null;
77 77 }
78 78 } else {
79 79 formModel[key] = value;
... ...