diff --git a/packages/form-render-react/src/renderers/DateRangePicker.tsx b/packages/form-render-react/src/renderers/DateRangePicker.tsx index 701b7dc..73862a7 100644 --- a/packages/form-render-react/src/renderers/DateRangePicker.tsx +++ b/packages/form-render-react/src/renderers/DateRangePicker.tsx @@ -22,21 +22,22 @@ const DateRangePicker: IProps = ({ schema, value, onChange, disabled, validator return ( { - if (val) { + if (val && val[0] && val[1]) { // 不是 showTime 的情况,endTime 时分秒设置到当日结束时间 - const startTime = showTime ? val[0] : val[0]?.startOf('day') - const endTime = showTime ? val[1] : val[1]?.endOf('day') + const startTime = showTime ? val[0] : val[0].startOf('day') + const endTime = showTime ? val[1] : val[1].endOf('day') onChange([toISOString(startTime), toISOString(endTime)]) } else { onChange(undefined) } }} - disabled={disabled} /> ) }