@@ -11,15 +11,15 @@ import {
1111} from '@patternfly/react-core' ;
1212
1313export const DateTimeRangePicker : React . FunctionComponent = ( ) => {
14- const [ from , setFrom ] = useState ( ) ;
15- const [ to , setTo ] = useState ( ) ;
14+ const [ from , setFrom ] = useState < Date | undefined > ( undefined ) ;
15+ const [ to , setTo ] = useState < Date | undefined > ( undefined ) ;
1616
17- const toValidator = ( date ) =>
17+ const toValidator = ( date : Date ) =>
1818 isValidDate ( from ) && yyyyMMddFormat ( date ) >= yyyyMMddFormat ( from )
1919 ? ''
2020 : 'The "to" date must be after the "from" date' ;
2121
22- const onFromDateChange = ( _event , inputDate , newFromDate ) => {
22+ const onFromDateChange = ( _event : React . FormEvent < HTMLInputElement > , inputDate : string , newFromDate : Date ) => {
2323 if ( isValidDate ( from ) && isValidDate ( newFromDate ) && inputDate === yyyyMMddFormat ( newFromDate ) ) {
2424 newFromDate . setHours ( from . getHours ( ) ) ;
2525 newFromDate . setMinutes ( from . getMinutes ( ) ) ;
@@ -29,7 +29,7 @@ export const DateTimeRangePicker: React.FunctionComponent = () => {
2929 }
3030 } ;
3131
32- const onFromTimeChange = ( _event , time , hour , minute ) => {
32+ const onFromTimeChange = ( _event : React . FormEvent < HTMLInputElement > , _time : string , hour : number , minute : number ) => {
3333 if ( isValidDate ( from ) ) {
3434 const updatedFromDate = new Date ( from ) ;
3535 updatedFromDate . setHours ( hour ) ;
@@ -38,7 +38,7 @@ export const DateTimeRangePicker: React.FunctionComponent = () => {
3838 }
3939 } ;
4040
41- const onToDateChange = ( _event , inputDate , newToDate ) => {
41+ const onToDateChange = ( _event : React . FormEvent < HTMLInputElement > , inputDate : string , newToDate : Date ) => {
4242 if ( isValidDate ( to ) && isValidDate ( newToDate ) && inputDate === yyyyMMddFormat ( newToDate ) ) {
4343 newToDate . setHours ( to . getHours ( ) ) ;
4444 newToDate . setMinutes ( to . getMinutes ( ) ) ;
@@ -48,7 +48,7 @@ export const DateTimeRangePicker: React.FunctionComponent = () => {
4848 }
4949 } ;
5050
51- const onToTimeChange = ( _event , time , hour , minute ) => {
51+ const onToTimeChange = ( _event : React . FormEvent < HTMLInputElement > , _time : string , hour : number , minute : number ) => {
5252 if ( isValidDate ( to ) ) {
5353 const updatedToDate = new Date ( to ) ;
5454 updatedToDate . setHours ( hour ) ;
0 commit comments