@@ -86,7 +86,7 @@ type DateTimePickerProps = {
86
86
nativeInputAriaLabel ?: string ;
87
87
onCalendarClose ?: ( ) => void ;
88
88
onCalendarOpen ?: ( ) => void ;
89
- onChange ?: ( value : Date | null ) => void ;
89
+ onChange ?: ( value : Value ) => void ;
90
90
onClockClose ?: ( ) => void ;
91
91
onClockOpen ?: ( ) => void ;
92
92
onFocus ?: ( event : React . FocusEvent < HTMLDivElement > ) => void ;
@@ -212,7 +212,7 @@ export default function DateTimePicker(props: DateTimePickerProps) {
212
212
closeClock ( ) ;
213
213
} , [ closeCalendar , closeClock ] ) ;
214
214
215
- function onChange ( value : Date | null , shouldCloseWidgets : boolean = shouldCloseWidgetsProps ) {
215
+ function onChange ( value : Value , shouldCloseWidgets : boolean = shouldCloseWidgetsProps ) {
216
216
if ( shouldCloseWidgets ) {
217
217
closeWidgets ( ) ;
218
218
}
@@ -222,7 +222,13 @@ export default function DateTimePicker(props: DateTimePickerProps) {
222
222
}
223
223
}
224
224
225
- function onDateChange ( nextValue : Value , shouldCloseWidgets ?: boolean ) {
225
+ type DatePiece = Date | null ;
226
+
227
+ function onDateChange (
228
+ nextValue : DatePiece | [ DatePiece , DatePiece ] ,
229
+ shouldCloseWidgets ?: boolean ,
230
+ ) {
231
+ // React-Calendar passes an array of values when selectRange is enabled
226
232
const [ nextValueFrom ] = Array . isArray ( nextValue ) ? nextValue : [ nextValue ] ;
227
233
const [ valueFrom ] = Array . isArray ( value ) ? value : [ value ] ;
228
234
0 commit comments