@@ -207,12 +207,17 @@ class DatePicker extends Component {
207
207
208
208
clickOutside = ( ) => {
209
209
this . validateDates ( ) ;
210
- this . setState ( { hidden : true } ) ;
210
+ this . setState ( {
211
+ hidden : true
212
+ } , ( ) => {
213
+ this . props . onBlur ( {
214
+ date : this . state . selectedDate ,
215
+ formattedDate : this . state . formattedDate
216
+ } ) ;
217
+ } ) ;
211
218
} ;
212
219
213
220
updateDate = ( date ) => {
214
- // console.log('Inside updateDate function. The event is: ', date);
215
-
216
221
if ( this . props . enableRangeSelection ) {
217
222
if ( date . length === 2 ) {
218
223
let firstDateMonth = date [ 0 ] . getMonth ( ) + 1 ;
@@ -269,7 +274,7 @@ class DatePicker extends Component {
269
274
render ( ) {
270
275
const { enableRangeSelection, disableWeekends, disableBeforeDate, disableAfterDate,
271
276
disableWeekday, disablePastDates, disableFutureDates, blockedDates, disabledDates,
272
- compact, className, inputProps, buttonProps, ...props } = this . props ;
277
+ compact, className, inputProps, buttonProps, onBlur , ...props } = this . props ;
273
278
274
279
const datePickerClasses = classnames (
275
280
'fd-date-picker' ,
@@ -303,6 +308,8 @@ class DatePicker extends Component {
303
308
< input
304
309
{ ...inputProps }
305
310
className = { datePickerInputClasses }
311
+ onBlur = { ( ) => onBlur ( { date : this . state . selectedDate ,
312
+ formattedDate : this . state . formattedDate } ) }
306
313
onChange = { this . modifyDate }
307
314
onClick = { ( ) => this . openCalendar ( 'input' ) }
308
315
onKeyPress = { this . sendUpdate }
@@ -350,7 +357,12 @@ DatePicker.propTypes = {
350
357
buttonProps : PropTypes . object ,
351
358
compact : PropTypes . bool ,
352
359
enableRangeSelection : PropTypes . bool ,
353
- inputProps : PropTypes . object
360
+ inputProps : PropTypes . object ,
361
+ onBlur : PropTypes . func
362
+ } ;
363
+
364
+ DatePicker . defaultProps = {
365
+ onBlur : ( ) => { }
354
366
} ;
355
367
356
368
DatePicker . propDescriptions = {
0 commit comments