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 Mar 2, 2018
1 parent fcc4590 commit cc30539
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 cc30539

Please sign in to comment.