Skip to content

Commit 4f2e311

Browse files
ssuperlilei李磊
andauthored
fix: 时间段处理出现 "Invalid Date“ (#237)
* fix: 时间段处理出现 "Invalid Date“ * fix(schema-form): 没有选时间段时删除字段 --------- Co-authored-by: 李磊 <[email protected]>
1 parent dc450cd commit 4f2e311

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/core/schema-form/src/hooks/useFormMethods.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ export const useFormMethods = (payload: UseFormMethodsPayload) => {
356356
}
357357

358358
const [startTime, endTime]: string[] = values[field];
359-
359+
if (!startTime || !endTime) {
360+
Reflect.deleteProperty(values, field);
361+
continue;
362+
}
360363
values[startTimeKey] = dateUtil(startTime).format(format);
361364
values[endTimeKey] = dateUtil(endTime).format(format);
362365
Reflect.deleteProperty(values, field);

0 commit comments

Comments
 (0)