static-cms/src/components/Widgets/DateTimeControl.js

23 lines
523 B
JavaScript
Raw Normal View History

2016-09-11 23:07:48 +02:00
import React, { PropTypes } from 'react';
import DateTime from 'react-datetime';
export default class DateTimeControl extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(datetime) {
this.props.onChange(datetime);
}
render() {
return <DateTime value={this.props.value || new Date()} onChange={this.handleChange}/>;
}
}
DateTimeControl.propTypes = {
onChange: PropTypes.func.isRequired,
value: PropTypes.object,
2016-09-11 23:07:48 +02:00
};