1
- var DateTimeField , DateTimePicker , Glyphicon , React , moment ;
1
+ var DateTimeField , DateTimePicker , Glyphicon , React , moment , _ ;
2
2
3
3
React = require ( 'react' ) ;
4
4
5
5
DateTimePicker = require ( './DateTimePicker' ) ;
6
6
7
7
moment = require ( 'moment' ) ;
8
8
9
+ _ = require ( 'lodash' ) ;
10
+
9
11
Glyphicon = require ( 'react-bootstrap' ) . Glyphicon ;
10
12
11
13
DateTimeField = React . createClass ( {
@@ -14,7 +16,8 @@ DateTimeField = React.createClass({
14
16
onChange : React . PropTypes . func ,
15
17
format : React . PropTypes . string ,
16
18
inputFormat : React . PropTypes . string ,
17
- inputProps : React . PropTypes . object
19
+ inputProps : React . PropTypes . object ,
20
+ defaultText : React . PropTypes . string
18
21
} ,
19
22
getDefaultProps : function ( ) {
20
23
return {
@@ -41,7 +44,7 @@ DateTimeField = React.createClass({
41
44
} ,
42
45
viewDate : moment ( this . props . dateTime , this . props . format , true ) . startOf ( "month" ) ,
43
46
selectedDate : moment ( this . props . dateTime , this . props . format , true ) ,
44
- inputValue : moment ( this . props . dateTime , this . props . format , true ) . format ( this . props . inputFormat )
47
+ inputValue : typeof this . props . defaultText == 'undefined' ? this . props . defaultText : moment ( this . props . dateTime , this . props . format , true ) . format ( this . props . inputFormat )
45
48
} ;
46
49
} ,
47
50
componentWillReceiveProps : function ( nextProps ) {
0 commit comments