@@ -28,7 +28,8 @@ var Datetime = createClass({
2828 onBlur : TYPES . func ,
2929 onChange : TYPES . func ,
3030 onCancel : TYPES . func ,
31- onSave : TYPES . func ,
31+ onSave : TYPES . func ,
32+ onOpen : TYPES . func ,
3233 locale : TYPES . string ,
3334 input : TYPES . bool ,
3435 // dateFormat: TYPES.string | TYPES.bool,
@@ -68,7 +69,11 @@ var Datetime = createClass({
6869 if ( state . open == undefined )
6970 state . open = ! this . props . input ;
7071
72+ if ( this . props . onOpen ) {
73+ this . props . onOpen ( this . props . defaultValue ) ;
74+ }
7175 state . currentView = this . props . viewMode ;
76+ state . initialDate = this . props . defaultValue ;
7277 return state ;
7378 } ,
7479
@@ -357,7 +362,7 @@ var Datetime = createClass({
357362 React . createElement ( 'div' ,
358363 { key : 'footer' , className : 'rdtPicker-footer' } , [ this . props . footer ? this . props . footer : '' ,
359364 React . createElement ( 'span' , { key : 'tpb' , className : 'timePickerButtons' } , [
360- React . createElement ( 'div' , { key : 'cancel' , className : 'cancelBtn' , onClick : this . props . onCancel . bind ( this ) } , 'Cancel' ) ,
365+ React . createElement ( 'div' , { key : 'cancel' , className : 'cancelBtn' , onClick : this . props . onCancel . bind ( this , this . state . initialDate ) } , 'Cancel' ) ,
361366 React . createElement ( 'div' , { key : 'save' , className : 'saveBtn ui mini button green' , onClick : this . props . onSave . bind ( this ) } , 'Save' ) ] ) ]
362367 )
363368 )
0 commit comments