Skip to content

Commit

Permalink
Update useFormEvents.ts (#514)
Browse files Browse the repository at this point in the history
fix: 修复 表单回显时,参数为null或者''时, 报Invalid date的错
  • Loading branch information
zuihou authored Apr 22, 2021
1 parent f4af231 commit e689ee5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Form/src/hooks/useFormEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ export function useFormEvents({
// time type
if (itemIsDateType(key)) {
if (Array.isArray(value)) {
const arr: moment.Moment[] = [];
const arr: any[] = [];
for (const ele of value) {
arr.push(dateUtil(ele));
arr.push(ele ? dateUtil(ele) : null);
}
formModel[key] = arr;
} else {
formModel[key] = dateUtil(value);
formModel[key] = value ? dateUtil(value) : null;
}
} else {
formModel[key] = value;
Expand Down

0 comments on commit e689ee5

Please sign in to comment.