Skip to content

Commit

Permalink
Use formatted datetime value in Redux.
Browse files Browse the repository at this point in the history
  • Loading branch information
tech4him1 authored and erquhart committed Mar 4, 2018
1 parent c422289 commit b7fcb8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/EditorWidgets/Date/DateControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default class DateControl extends React.Component {
};

componentDidMount() {
const { value, field, onChange } = this.props;
this.format = field.get('format');
const { includeTime, value, field, onChange } = this.props;
this.format = field.get('format') || (includeTime ? DEFAULT_DATETIME_FORMAT : DEFAULT_DATE_FORMAT);

/**
* Set the current date as default value if no default value is provided. An
Expand All @@ -45,7 +45,7 @@ export default class DateControl extends React.Component {

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

0 comments on commit b7fcb8b

Please sign in to comment.