2016-04-18 10:03:53 +09:00
|
|
|
import React, { PropTypes, Component } from 'react';
|
2016-07-06 15:53:14 +02:00
|
|
|
import DateTimeField from 'react-datetime';
|
2016-06-07 15:03:00 +09:00
|
|
|
import moment from 'moment';
|
2016-04-18 10:03:53 +09:00
|
|
|
|
|
|
|
class DateTime extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="form-group row">
|
|
|
|
<label className="control-label col-sm-3">{this.props.label}</label>
|
2016-07-06 15:53:14 +02:00
|
|
|
<div className="col-sm-9">
|
|
|
|
<DateTimeField
|
|
|
|
value={this.props.value || new Date()}
|
|
|
|
defaultValue={moment().format("x")}
|
|
|
|
onChange={newDate => this.props.updateCurrentValue(this.props.name, newDate._d)}
|
|
|
|
format={"x"}
|
|
|
|
inputProps={{name: this.props.name}}
|
|
|
|
/>
|
|
|
|
</div>
|
2016-04-18 10:03:53 +09:00
|
|
|
</div>
|
2016-07-06 15:53:14 +02:00
|
|
|
);
|
2016-04-18 10:03:53 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DateTime.propTypes = {
|
2016-07-06 15:53:14 +02:00
|
|
|
control: React.PropTypes.any,
|
|
|
|
datatype: React.PropTypes.any,
|
|
|
|
group: React.PropTypes.any,
|
2016-04-18 10:03:53 +09:00
|
|
|
label: React.PropTypes.string,
|
2016-07-06 15:53:14 +02:00
|
|
|
updateCurrentValue: React.PropTypes.func,
|
|
|
|
name: React.PropTypes.string,
|
|
|
|
value: React.PropTypes.any,
|
2016-04-18 10:03:53 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export default DateTime;
|