Skip to content

Commit

Permalink
Fixed #1711 - Calendar input does not update view when hourFormat cha…
Browse files Browse the repository at this point in the history
…nges
  • Loading branch information
mertsincan committed Jan 28, 2021
1 parent d655751 commit ab00ed0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/calendar/Calendar.js
Expand Up @@ -255,11 +255,11 @@ export class Calendar extends Component {
}
}

if(this.panel) {
if (this.panel) {
this.updateFocus();
}

if (prevProps.value !== this.props.value && (!this.viewStateChanged || !this.state.overlayVisible)) {
if ((prevProps.value !== this.props.value && (!this.viewStateChanged || !this.state.overlayVisible)) || this.isOptionChanged(prevProps)) {
this.updateInputfield(this.props.value);
}
}
Expand Down Expand Up @@ -294,6 +294,11 @@ export class Calendar extends Component {
});
}

isOptionChanged(prevProps) {
const optionProps = ['dateFormat', 'hourFormat', 'timeOnly', 'showSeconds', 'showMillisec'];
return optionProps.some((option) => prevProps[option] !== this.props[option]);
}

getDateFormat() {
return this.props.dateFormat || localeOption('dateFormat', this.props.locale);
}
Expand Down

0 comments on commit ab00ed0

Please sign in to comment.