Skip to content

Commit

Permalink
* datetime-picker: support for reseting state for time picker.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jul 17, 2024
1 parent fc2d2ac commit 35d9059
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/datetime-picker/src/component/time-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export class TimePicker extends Pick<PickState, TimePickerOptions> {
icon: true,
} as Partial<PickOptions>;

constructor(props: TimePickerOptions) {
super(props);
const state = this.state as PickState;
getDefaultState(props?: RenderableProps<TimePickerOptions> | undefined): PickState {
const state = super.getDefaultState(props);
if (state.value === 'now') {
state.value = formatDate(new Date(), props.format);
state.value = formatDate(new Date(), (props || this.props).format);
}
return state;
}

_handleInputFocus = () => {
Expand Down

0 comments on commit 35d9059

Please sign in to comment.