Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Converted `EuiFacetButton` to TypeScript ([#2226](https://github.com/elastic/eui/pull/2226))
- Adds an optional onClose prop to the the EuiDatePicker component ([#2235](https://github.com/elastic/eui/pull/2235))
Comment thread
jasonrhodes marked this conversation as resolved.
Outdated

**Bug fixes**

Expand Down
10 changes: 10 additions & 0 deletions src-docs/src/views/date_picker/states.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ export default class extends Component {

<EuiSpacer size="m" />

<EuiDatePicker
showTimeSelect
selected={this.state.startDate}
onChange={this.handleChange}
onClear={() => this.handleChange(null)}
placeholder="Clearable"
/>

<EuiSpacer size="m" />

<EuiDatePicker
showTimeSelect
selected={this.state.startDate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`EuiDatePicker is rendered 1`] = `
className="euiDatePicker euiDatePicker--shadow"
>
<EuiFormControlLayout
clear={null}
fullWidth={false}
icon="calendar"
isLoading={false}
Expand Down
6 changes: 6 additions & 0 deletions src/components/date_picker/date_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class EuiDatePicker extends Component {
minDate,
minTime,
onChange,
onClear,
openToDate,
placeholder,
popperClassName,
Expand Down Expand Up @@ -127,6 +128,7 @@ export class EuiDatePicker extends Component {
<EuiFormControlLayout
icon={optionalIcon}
fullWidth={fullWidth}
clear={selected && onClear ? { onClick: onClear } : null}
isLoading={isLoading}>
<EuiValidatableControl isInvalid={isInvalid}>
<DatePicker
Expand Down Expand Up @@ -246,6 +248,10 @@ EuiDatePicker.propTypes = {
* What to do when the input changes
*/
onChange: PropTypes.func,
/**
* What to do when the input is cleared by the x icon
*/
onClear: PropTypes.func,
/**
* Opens to this date (in moment format) on first press, regardless of selection
*/
Expand Down