File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ var DateInput = React.createClass({
28
28
29
29
getInitialState ( ) {
30
30
return {
31
- maybeDate : this . safeDateFormat ( this . props )
31
+ value : this . safeDateFormat ( this . props )
32
32
}
33
33
} ,
34
34
@@ -37,7 +37,7 @@ var DateInput = React.createClass({
37
37
newProps . locale !== this . props . locale ||
38
38
newProps . dateFormat !== this . props . dateFormat ) {
39
39
this . setState ( {
40
- maybeDate : this . safeDateFormat ( newProps )
40
+ value : this . safeDateFormat ( newProps )
41
41
} )
42
42
}
43
43
} ,
@@ -60,20 +60,18 @@ var DateInput = React.createClass({
60
60
this . props . onChangeDate ( null )
61
61
}
62
62
}
63
- this . setState ( {
64
- maybeDate : value
65
- } )
63
+ this . setState ( { value} )
66
64
} ,
67
65
68
66
safeDateFormat ( props ) {
69
67
return props . date && props . date . clone ( )
70
68
. locale ( props . locale || moment . locale ( ) )
71
- . format ( props . dateFormat )
69
+ . format ( props . dateFormat ) || ''
72
70
} ,
73
71
74
72
handleBlur ( event ) {
75
73
this . setState ( {
76
- maybeDate : this . safeDateFormat ( this . props )
74
+ value : this . safeDateFormat ( this . props )
77
75
} )
78
76
if ( this . props . onBlur ) {
79
77
this . props . onBlur ( event )
@@ -89,7 +87,7 @@ var DateInput = React.createClass({
89
87
ref = 'input'
90
88
type = 'text'
91
89
{ ...this . props }
92
- value = { this . state . maybeDate }
90
+ value = { this . state . value }
93
91
onBlur = { this . handleBlur }
94
92
onChange = { this . handleChange } />
95
93
}
You can’t perform that action at this time.
0 commit comments