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

PropTypes show warning when passing Moment instance for date #166

Closed
keith-kurak opened this issue Sep 12, 2017 · 3 comments
Closed

PropTypes show warning when passing Moment instance for date #166

keith-kurak opened this issue Sep 12, 2017 · 3 comments
Labels

Comments

@keith-kurak
Copy link

Issue

The documentation on the readme says that a Moment instance is an acceptable value for the date prop of DatePicker. It seems to work just fine when you pass a Moment.js instance, except that a PropTypes warning appears: "Failed PropType Invalid prop date supplied to DatePicker..

Expected Behavior

There is no PropTypes warning.

Code

constructor() {
  this.state = {
    date: new Moment(),
  }
}

render() {
  return (
    <DatePicker date={this.state.date} />
  );
}
@colincwilliams
Copy link

colincwilliams commented Oct 5, 2017

+1

For what it's worth, it's pretty easy to work around by passing in yourMoment.toDate() instead, but it would be nice to be able to pass in the moment directly.

@femiveys
Copy link

Why does the documentation say you can pass a Moment instance if in reality you can't?

@feyy
Copy link
Contributor

feyy commented Oct 17, 2017

So sorry. will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants