diff --git a/src/components/datepicker.js b/src/components/datepicker.js index fd450ed4..db4dc940 100644 --- a/src/components/datepicker.js +++ b/src/components/datepicker.js @@ -58,6 +58,7 @@ class SemanticDatepicker extends React.Component { keepOpenOnClear: PropTypes.bool, keepOpenOnSelect: PropTypes.bool, locale: PropTypes.object, + onBlur: PropTypes.func, onDateChange: PropTypes.func.isRequired, placeholder: PropTypes.string, selected: PropTypes.oneOfType([ @@ -78,6 +79,7 @@ class SemanticDatepicker extends React.Component { keepOpenOnClear: false, keepOpenOnSelect: false, locale: localeEn, + onBlur: () => {}, placeholder: null, pointing: 'left', selected: null, @@ -235,10 +237,12 @@ class SemanticDatepicker extends React.Component { }); }; - handleBlur = () => { - const { format } = this.props; + handleBlur = event => { + const { format, onBlur } = this.props; const { typedValue } = this.state; + onBlur(event); + if (!typedValue) { return; }