@@ -133,7 +133,10 @@ export type TimeCompViewProps = Pick<
133
133
} ;
134
134
135
135
export const timePickerControl = new UICompBuilder ( childrenMap , ( props ) => {
136
- const time = dayjs ( props . value . value , TimeParser ) ;
136
+ let time = dayjs ( null ) ;
137
+ if ( props . value . value !== '' ) {
138
+ time = dayjs ( props . value . value , TimeParser ) ;
139
+ }
137
140
138
141
return props . label ( {
139
142
required : props . required ,
@@ -147,8 +150,8 @@ export const timePickerControl = new UICompBuilder(childrenMap, (props) => {
147
150
disabledTime = { ( ) => disabledTime ( props . minTime , props . maxTime ) }
148
151
{ ...timePickerComps ( props ) }
149
152
hourStep = { props . hourStep as hourStepType }
150
- minuteStep = { props . hourStep as minuteStepType }
151
- secondStep = { props . hourStep as secondStepType }
153
+ minuteStep = { props . minuteStep as minuteStepType }
154
+ secondStep = { props . secondStep as secondStepType }
152
155
onChange = { ( time ) => {
153
156
handleDateChange (
154
157
time && time . isValid ( ) ? time . format ( TIME_FORMAT ) : "" ,
@@ -209,21 +212,27 @@ export const timeRangeControl = (function () {
209
212
} ;
210
213
211
214
return new UICompBuilder ( childrenMap , ( props ) => {
212
- const start = dayjs ( props . start . value , TimeParser ) ;
213
- const end = dayjs ( props . end . value , TimeParser ) ;
215
+ let start = null ;
216
+ if ( props . start . value !== '' ) {
217
+ start = dayjs ( props . start . value , TimeParser ) ;
218
+ }
219
+ let end = null ;
220
+ if ( props . end . value !== '' ) {
221
+ end = dayjs ( props . end . value , TimeParser ) ;
222
+ }
214
223
215
224
const children = (
216
225
< TimeRangeUIView
217
226
viewRef = { props . viewRef }
218
227
$style = { props . style }
219
228
disabled = { props . disabled }
220
- start = { start . isValid ( ) ? start : null }
221
- end = { end . isValid ( ) ? end : null }
229
+ start = { start ? .isValid ( ) ? start : null }
230
+ end = { end ? .isValid ( ) ? end : null }
222
231
disabledTime = { ( ) => disabledTime ( props . minTime , props . maxTime ) }
223
232
{ ...timePickerComps ( props ) }
224
233
hourStep = { props . hourStep as hourStepType }
225
- minuteStep = { props . hourStep as minuteStepType }
226
- secondStep = { props . hourStep as secondStepType }
234
+ minuteStep = { props . minuteStep as minuteStepType }
235
+ secondStep = { props . secondStep as secondStepType }
227
236
onChange = { ( start , end ) => {
228
237
props . start . onChange ( start && start . isValid ( ) ? start . format ( TIME_FORMAT ) : "" ) ;
229
238
props . end . onChange ( end && end . isValid ( ) ? end . format ( TIME_FORMAT ) : "" ) ;
0 commit comments