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] Enabling setting a month/date that the picker opens on #4900

Closed
davebream opened this issue Aug 4, 2016 · 7 comments
Closed
Labels
component: date picker This is the name of the generic UI component, not the React module!

Comments

@davebream
Copy link

davebream commented Aug 4, 2016

If I understand the documentation well, as for now there is no way to force the date picker to open on specific month/date. This would be really great. If I set a minDate in the future, the user has to click a lot to move to the month with dates that are enabled to be selected.

Also I think that It would be more user-friendly if the DatePicker's default month would be the month of the minDate, if it's present of course.

@mpontikes
Copy link

I agree this would be a nice feature. The current work around is setting the defaultDate value to the date you want it to open on.

@davebream
Copy link
Author

@mpontikes I need the default field value to be empty. Also I'm using a controlled input. This is used in a search form which should allow no date input filled.

@oliviertassinari oliviertassinari added the component: date picker This is the name of the generic UI component, not the React module! label Oct 19, 2016
@skosch
Copy link

skosch commented Nov 9, 2016

This is a problem for me as well.
It seems like the cleanest way to fix this problem is to add something like

else if (props.defaultValue) {
  return props.defaultValue;
}

to DatePicker.js#L237.

@emptycrown
Copy link

Has anyone found a solution to this?

@sigmike
Copy link

sigmike commented Jun 20, 2017

One way to do that with the current implementation is to keep a ref to the date picker component and call setState directly on it, which is ugly and will certainly break some day but it works for now. Something like this:

<DatePicker
  ref={(c) => this.picker = c}
  minDate={minDate}
  onShow={() => {
    if (this.picker.state.date === undefined)
      this.picker.setState({dialogDate: minDate})
    }
  }
/>

It would be much better if the default dialog date was the min date when one is provided.

@kelexel
Copy link

kelexel commented Jun 20, 2017

Hello, same problem here..
What is the status of this issue ?

Thank you

@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

7 participants