Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DatePicker] Can't reset date #5696

Closed
MihaMarkic opened this issue Dec 1, 2016 · 2 comments
Closed

[DatePicker] Can't reset date #5696

MihaMarkic opened this issue Dec 1, 2016 · 2 comments
Labels
component: date picker This is the name of the generic UI component, not the React module!

Comments

@MihaMarkic
Copy link

Problem description

Using DatePicker user can't reset the date once it is set. It could be solved by allowing typing of the date (I see it is a separate request) or with a button either on input field or dialog.

Link to minimally-working code that reproduces the issue

Versions

  • Material-UI: 0.16.4
  • React: 15.4.1
  • Browser: any
@oliviertassinari oliviertassinari added the component: date picker This is the name of the generic UI component, not the React module! label Dec 18, 2016
@oliviertassinari oliviertassinari changed the title Can't reset date with DatePicker [DatePicker] Can't reset date Dec 18, 2016
@linonetwo
Copy link

Use controlled component

              <DatePicker
                className={styles.date}
                hintText="终止日期"
                container="inline"
                value={this.state.filter.toTime}
                onDismiss={() => this.toTimeHandler(null, null, true)}
                onChange={this.toTimeHandler}
              />

  toTimeHandler = (event, date, cancel) => {
    const nextState = Object.assign({}, this.state);
    if (!cancel) {
      nextState.filter.toTime = date;
    } else {
      nextState.filter.toTime = null;
    }
    this.setState(nextState);
  };

@oliviertassinari
Copy link
Member

Closing for #4787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

3 participants