Skip to content

Commit 89d25b7

Browse files
authored
Merge pull request pnp#1278 from milanholemans/datepicker-onchangecleardate
Trigger `onChange` event when clearing date for the `DateTimePicker`
2 parents c022ec6 + 732c2a0 commit 89d25b7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/controls/dateTimePicker/DateTimePicker.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
119119
this.setState({
120120
day: null
121121
});
122+
123+
if (this.props.onChange) {
124+
this.props.onChange(null);
125+
}
122126
}
123127

124128
/**
@@ -334,8 +338,8 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
334338
}}
335339
/>
336340
</div>
337-
{showClearDate === true && this.state.day !==null ? <IconButton iconProps={{iconName: showClearDateIcon}} onClick={() => this.clearDate()} /> : <></>}
338-
341+
{showClearDate === true && this.state.day !== null && <IconButton iconProps={{iconName: showClearDateIcon}} onClick={() => this.clearDate()} />}
342+
339343
</div>
340344

341345
{timeElm}

0 commit comments

Comments
 (0)