Skip to content

Commit

Permalink
remove local transientDate state
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Pansch committed Mar 11, 2024
1 parent b691c91 commit 7bfae8a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/react-ui-components/src/DateInput/dateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,12 @@ const defaultProps: PickDefaultProps<DateInputProps, 'labelFormat' | 'timeConstr
};

interface DateInputState {
readonly isOpen: boolean;
readonly transientDate: Date | null; // TODO do we have a breaking change when we use 'undefined' in favor of 'null'?
readonly isOpen: boolean

}

const initialState: DateInputState = {
isOpen: false,
transientDate: null
isOpen: false
};

export class DateInput extends PureComponent<DateInputProps, DateInputState> {
Expand Down Expand Up @@ -246,11 +245,7 @@ export class DateInput extends PureComponent<DateInputProps, DateInputState> {

private readonly handleChange = (value: Moment | string) => {
const momentVal: Moment = isMoment(value) ? value : moment(value);
const selectedDate = momentVal.toDate()
this.setState({
transientDate: selectedDate
});
this.props.onChange(selectedDate);
this.props.onChange(momentVal.toDate());
}

private readonly handleSelectTodayBtnClick = () => {
Expand Down

0 comments on commit 7bfae8a

Please sign in to comment.