Skip to content

Commit

Permalink
Merge branch 'master' into checkbox-skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh authored Jan 7, 2020
2 parents 45ed96f + ef0752e commit 62e84d4
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/react/src/components/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,22 @@ export default class DatePicker extends Component {
}
}

componentDidUpdate({ dateFormat: prevDateFormat }) {
const { dateFormat } = this.props;
if (this.cal && prevDateFormat !== dateFormat) {
this.cal.set({ dateFormat });
componentDidUpdate({
dateFormat: prevDateFormat,
minDate: prevMinDate,
maxDate: prevMaxDate,
}) {
const { dateFormat, minDate, maxDate } = this.props;
if (this.cal) {
if (prevDateFormat !== dateFormat) {
this.cal.set({ dateFormat });
}
if (prevMinDate !== minDate) {
this.cal.set('minDate', minDate);
}
if (prevMaxDate !== maxDate) {
this.cal.set('maxDate', maxDate);
}
}
}

Expand Down

0 comments on commit 62e84d4

Please sign in to comment.