Malliapi, Chris (UK - London)
2015-04-11 b5a339e21bd2e457314a358d20561fb244eaad37
defaultText prop added
1 files modified
9 ■■■■■ changed files
src/DateTimeField.jsx 9 ●●●●● patch | view | raw | blame | history
src/DateTimeField.jsx
@@ -1,10 +1,12 @@
var DateTimeField, DateTimePicker, Glyphicon, React, moment;
var DateTimeField, DateTimePicker, Glyphicon, React, moment, _;
React = require('react');
DateTimePicker = require('./DateTimePicker');
moment = require('moment');
_ = require('lodash');
Glyphicon = require('react-bootstrap').Glyphicon;
@@ -14,7 +16,8 @@
    onChange: React.PropTypes.func,
    format: React.PropTypes.string,
    inputFormat: React.PropTypes.string,
    inputProps: React.PropTypes.object
    inputProps: React.PropTypes.object,
    defaultText: React.PropTypes.string
  },
  getDefaultProps: function() {
    return {
@@ -41,7 +44,7 @@
      },
      viewDate: moment(this.props.dateTime, this.props.format, true).startOf("month"),
      selectedDate: moment(this.props.dateTime, this.props.format, true),
      inputValue: moment(this.props.dateTime, this.props.format, true).format(this.props.inputFormat)
      inputValue: typeof this.props.defaultText == 'undefined' ?  this.props.defaultText : moment(this.props.dateTime, this.props.format, true).format(this.props.inputFormat)
    };
  },
  componentWillReceiveProps: function(nextProps) {