File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,6 @@ DateTimeField = React.createClass({
3535 }
3636 } ;
3737 } ,
38- resolvePropsInputFormat : function ( ) {
39- if ( this . props . inputFormat ) return this . props . inputFormat ;
40- switch ( this . props . mode ) {
41- case Constants . MODE_TIME :
42- return "h:mm A" ;
43- case Constants . MODE_DATE :
44- return "MM/DD/YY" ;
45- default :
46- return "MM/DD/YY h:mm A" ;
47- }
48- } ,
4938 getInitialState : function ( ) {
5039 return {
5140 showDatePicker : this . props . mode !== Constants . MODE_TIME ,
@@ -71,6 +60,22 @@ DateTimeField = React.createClass({
7160 inputValue : moment ( nextProps . dateTime , nextProps . format , true ) . format ( nextProps . inputFormat )
7261 } ) ;
7362 }
63+ if ( nextProps . inputFormat !== this . props . inputFormat ) {
64+ return this . setState ( {
65+ inputFormat : nextProps . inputFormat
66+ } ) ;
67+ }
68+ } ,
69+ resolvePropsInputFormat : function ( ) {
70+ if ( this . props . inputFormat ) return this . props . inputFormat ;
71+ switch ( this . props . mode ) {
72+ case Constants . MODE_TIME :
73+ return "h:mm A" ;
74+ case Constants . MODE_DATE :
75+ return "MM/DD/YY" ;
76+ default :
77+ return "MM/DD/YY h:mm A" ;
78+ }
7479 } ,
7580 onChange : function ( event ) {
7681 var value = event . target == null ? event : event . target . value ;
You can’t perform that action at this time.
0 commit comments