@@ -10,7 +10,7 @@ import DateInput from 'react-date-picker/dist/cjs/DateInput';
1010
1111import { isMaxDate , isMinDate } from './shared/propTypes' ;
1212
13- import type { ClassName , Detail , LooseValue } from './shared/types' ;
13+ import type { ClassName , Detail , LooseValue , Value } from './shared/types' ;
1414
1515const baseClassName = 'react-daterange-picker' ;
1616const outsideActionEvents = [ 'mousedown' , 'focusin' , 'touchstart' ] ;
@@ -77,7 +77,7 @@ type DateRangePickerProps = {
7777 nativeInputAriaLabel ?: string ;
7878 onCalendarClose ?: ( ) => void ;
7979 onCalendarOpen ?: ( ) => void ;
80- onChange ?: ( value : Date | null | ( Date | null ) [ ] ) => void ;
80+ onChange ?: ( value : Value ) => void ;
8181 onFocus ?: ( event : React . FocusEvent < HTMLDivElement > ) => void ;
8282 openCalendarOnFocus ?: boolean ;
8383 portalContainer ?: HTMLElement ;
@@ -160,10 +160,7 @@ export default function DateRangePicker(props: DateRangePickerProps) {
160160 }
161161 }
162162
163- function onChange (
164- value : Date | null | ( Date | null ) [ ] ,
165- shouldCloseCalendar = shouldCloseCalendarProps ,
166- ) {
163+ function onChange ( value : Value , shouldCloseCalendar = shouldCloseCalendarProps ) {
167164 if ( shouldCloseCalendar ) {
168165 closeCalendar ( ) ;
169166 }
@@ -173,7 +170,7 @@ export default function DateRangePicker(props: DateRangePickerProps) {
173170 }
174171 }
175172
176- function onChangeFrom ( nextValue : Date | null | ( Date | null ) [ ] , closeCalendar : boolean ) {
173+ function onChangeFrom ( nextValue : Value , closeCalendar : boolean ) {
177174 const [ nextValueFrom ] = Array . isArray ( nextValue ) ? nextValue : [ nextValue ] ;
178175 const [ , valueTo ] = Array . isArray ( value ) ? value : [ value ] ;
179176
@@ -182,7 +179,7 @@ export default function DateRangePicker(props: DateRangePickerProps) {
182179 onChange ( [ nextValueFrom || null , valueToDate ] , closeCalendar ) ;
183180 }
184181
185- function onChangeTo ( nextValue : Date | null | ( Date | null ) [ ] , closeCalendar : boolean ) {
182+ function onChangeTo ( nextValue : Value , closeCalendar : boolean ) {
186183 const [ , nextValueTo ] = Array . isArray ( nextValue ) ? nextValue : [ null , nextValue ] ;
187184 const [ valueFrom ] = Array . isArray ( value ) ? value : [ value ] ;
188185
0 commit comments