@@ -92,7 +92,7 @@ var Datetime = React.createClass({
9292 viewDate : viewDate ,
9393 selectedDate : selectedDate ,
9494 inputValue : selectedDate ? selectedDate . format ( formats . datetime ) : ( date || '' ) ,
95- open : props . open != undefined ? props . open : this . state && this . state . open
95+ open : props . open
9696 } ;
9797 } ,
9898
@@ -246,7 +246,7 @@ var Datetime = React.createClass({
246246 viewDate = this . state . viewDate ,
247247 currentDate = this . state . selectedDate || viewDate ,
248248 date
249- ;
249+ ;
250250
251251 if ( target . className . indexOf ( "rdtDay" ) != - 1 ) {
252252 if ( target . className . indexOf ( "rdtNew" ) != - 1 )
@@ -278,13 +278,15 @@ var Datetime = React.createClass({
278278 this . setState ( {
279279 selectedDate : date ,
280280 viewDate : date . clone ( ) . startOf ( 'month' ) ,
281- inputValue : date . format ( this . state . inputFormat )
282- } , function ( ) {
283- if ( this . props . closeOnSelect && close ) {
284- this . closeCalendar ( ) ;
285- }
281+ inputValue : date . format ( this . state . inputFormat ) ,
282+ open : ! ( this . props . closeOnSelect && close )
286283 } ) ;
287284 }
285+ else {
286+ if ( this . props . closeOnSelect && close ) {
287+ this . closeCalendar ( ) ;
288+ }
289+ }
288290
289291 this . props . onChange ( date ) ;
290292 } ,
@@ -298,6 +300,7 @@ var Datetime = React.createClass({
298300
299301 closeCalendar : function ( ) {
300302 this . setState ( { open : false } ) ;
303+ this . props . onBlur ( this . state . selectedDate || this . state . inputValue ) ;
301304 } ,
302305
303306 handleClickOutside : function ( ) {
0 commit comments