This repository was archived by the owner on Nov 16, 2018. It is now read-only.
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({
35
35
}
36
36
} ;
37
37
} ,
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
- } ,
49
38
getInitialState : function ( ) {
50
39
return {
51
40
showDatePicker : this . props . mode !== Constants . MODE_TIME ,
@@ -71,6 +60,22 @@ DateTimeField = React.createClass({
71
60
inputValue : moment ( nextProps . dateTime , nextProps . format , true ) . format ( nextProps . inputFormat )
72
61
} ) ;
73
62
}
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
+ }
74
79
} ,
75
80
onChange : function ( event ) {
76
81
var value = event . target == null ? event : event . target . value ;
You can’t perform that action at this time.
0 commit comments