Skip to content

Commit

Permalink
exlude time from default date widget format
Browse files Browse the repository at this point in the history
  • Loading branch information
erquhart committed Mar 2, 2018
1 parent 5b5e035 commit fcc4590
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/EditorWidgets/Date/DateControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import PropTypes from 'prop-types';
import DateTime from 'react-datetime';
import moment from 'moment';

const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD';
const DEFAULT_DATETIME_FORMAT = moment.defaultFormat;

export default class DateControl extends React.Component {
static propTypes = {
field: PropTypes.object.isRequired,
Expand Down Expand Up @@ -42,7 +45,7 @@ export default class DateControl extends React.Component {

render() {
const { includeTime, value, classNameWrapper, setActiveStyle, setInactiveStyle } = this.props;
const format = this.format || moment.defaultFormat;
const format = this.format || (includeTime ? DEFAULT_DATETIME_FORMAT : DEFAULT_DATE_FORMAT);
return (
<DateTime
timeFormat={!!includeTime}
Expand Down

0 comments on commit fcc4590

Please sign in to comment.