static-cms/src/components/Widgets/DateControl.js
Mathias Biilmann d81d0d416f Widget fixes (#162)
* Make string the default widget if none is specified

* Linting fixes for PreviewPane

* Linting fixes for ControlPane

* Add date widget

* Fix name of date control class

* Fix spaces in list control with no fields

* Fix linting error for List Control

* Fix linting errors in raw editor

* Add Select widget

* Fix linting error
2016-11-17 10:08:37 -02:00

22 lines
466 B
JavaScript

import React, { PropTypes } from 'react';
import DateTime from 'react-datetime';
export default class DateControl extends React.Component {
handleChange = (datetime) => {
this.props.onChange(datetime);
};
render() {
return (<DateTime
timeFormat={false}
value={this.props.value || new Date()}
onChange={this.handleChange}
/>);
}
}
DateControl.propTypes = {
onChange: PropTypes.func.isRequired,
value: PropTypes.object,
};