Fix newsletter scheduling related required proptype issues
This commit is contained in:
@@ -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 = {
|
||||
|
@@ -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,
|
||||
};
|
||||
|
@@ -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 = {
|
||||
|
Reference in New Issue
Block a user