skratchdot / react-bootstrap-daterangepicker

A date/time picker for react (using bootstrap). This is a react wrapper around the bootstrap-daterangepicker project.
http://projects.skratchdot.com/react-bootstrap-daterangepicker/
Other
475 stars 204 forks source link

this.props undefined #201

Closed grinsteindavid closed 4 years ago

grinsteindavid commented 5 years ago

Hi! I got this error this.props undefined

from handleEvent

export default class Component extends React.Component {

handleEvent(event, picker) {
    alert(JSON.stringify([picker.startDate, picker.endDate]))
    this.props.onChange(picker)
}

render() {

    return (
        <DateRangePicker 
            startDate={this.props.startDate} 
            endDate={this.props.endDate}
            onApply={this.handleEvent}
            ranges={ranges}
        >
            <Input
                icon='calendar' 
                iconPosition='left'
                fluid={this.props.fluid || false}
                value={`${this.props.startDate} - ${this.props.endDate}`}
            />
        </DateRangePicker>
    )
}

}

<CustomDateRangePicker startDate="1/1/2014" endDate="1/2/2014" onChange={(picker) => alert(picker.startDate)} />

skratchdot commented 4 years ago

closing this due to inactivity. please re-open if this is still an issue in v6.0.0 or greater