Skip to content

Commit

Permalink
Merge branch 'adding_timezone'
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbuks committed Sep 16, 2024
2 parents 8fc5ca8 + 468d369 commit bdc4248
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,17 @@ type State = {
}

export default class ManageTimezones extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
const useAutomaticTimezone = (
props.useAutomaticTimezone === 'true' ||
props.useAutomaticTimezone === true
);
this.state = {
static getDerivedStateFromProps(nextProps: Props) {
const useAutomaticTimezone = nextProps.useAutomaticTimezone === 'true' || nextProps.useAutomaticTimezone === true;
return {
useAutomaticTimezone,
automaticTimezone: props.automaticTimezone,
manualTimezone: props.manualTimezone,
automaticTimezone: nextProps.automaticTimezone,
manualTimezone: nextProps.manualTimezone,
isSaving: false,
openMenu: false,
selectedOption: {
label: props.timezoneLabel,
value: useAutomaticTimezone ? props.automaticTimezone : props.manualTimezone,
label: nextProps.timezoneLabel,
value: useAutomaticTimezone ? nextProps.automaticTimezone : nextProps.manualTimezone,
},
};
}
Expand Down

0 comments on commit bdc4248

Please sign in to comment.