Fix newsletter scheduling related required proptype issues

This commit is contained in:
Tautvidas Sipavičius
2018-11-01 02:04:18 +02:00
parent 7c19aecaa0
commit d46f9203ee
3 changed files with 8 additions and 5 deletions

View File

@@ -75,7 +75,7 @@ class DateText extends React.Component {
jQuery.datepicker.parseDate = function parseDate(format, value) {
// Transform string format to Date object
return MailPoet.Date.toDate(value, {
parseFormat: this.props.dateDisplayFormat,
parseFormat: this.props.displayFormat,
format,
});
};
@@ -163,7 +163,6 @@ DateText.propTypes = {
value: PropTypes.string.isRequired,
disabled: PropTypes.bool.isRequired,
validation: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
dateDisplayFormat: PropTypes.string.isRequired,
};
DateText.defaultProps = {

View File

@@ -5,7 +5,11 @@ import DateText from 'newsletters/send/date_text.jsx';
import TimeSelect from 'newsletters/send/time_select.jsx';
class DateTime extends React.Component {
state = this.buildStateFromProps(this.props);
constructor(props) {
super(props);
this.state = this.buildStateFromProps(props);
}
componentWillReceiveProps(nextProps) {
this.setState(this.buildStateFromProps(nextProps));
@@ -74,7 +78,7 @@ DateTime.propTypes = {
onChange: PropTypes.func,
name: PropTypes.string,
disabled: PropTypes.bool,
dateValidation: PropTypes.objectOf(PropTypes.string).isRequired,
dateValidation: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
timeValidation: PropTypes.any, // eslint-disable-line react/forbid-prop-types
timeOfDayItems: PropTypes.objectOf(PropTypes.string).isRequired,
};

View File

@@ -34,7 +34,7 @@ TimeSelect.propTypes = {
value: PropTypes.string.isRequired,
disabled: PropTypes.bool,
onChange: PropTypes.func.isRequired,
validation: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
validation: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
TimeSelect.defaultProps = {