vlad-doru / react-native-calendar-datepicker

React-Native cross-platform, calendar component.
Apache License 2.0
85 stars 37 forks source link

How to get selected date #17

Open pkassonss opened 7 years ago

pkassonss commented 7 years ago

Just started using this, works great !

But, i do not have a state object 'date' and the examples are show that (this.state.date).

Ok, it works, but when I try to use it / format it, system says it can't find it :can't find variable date.

What is best practice to use it as a component:

       <Calendar style={styles.calendar} onChange={(date) => this.setState({date})} selected={this.state.date}
       minDate={moment().startOf('day')}
       maxDate={moment().add(10, 'years').startOf('day')}
       />

All good, but again, this.state.date not defined ... if I use something else, it crashes render saying invalid date format.

Thanks !

abhishek0058 commented 6 years ago

+1

abhishek0058 commented 6 years ago

+1