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

Clear date inputs dosn't fire onChange props method! #58

Open
kleviscipi opened this issue Apr 11, 2020 · 3 comments
Open

Clear date inputs dosn't fire onChange props method! #58

kleviscipi opened this issue Apr 11, 2020 · 3 comments

Comments

@kleviscipi
Copy link

Using RangeDatePicker in combination with props clear, the event fire doesn't call the method onChange . I am using this library and it is great but is very necessary for me to have that feature.
A props *onClear should be great, which is called when handleInputClear (inside the RangeDatePicker) is fired

@SarahAlAshwal
Copy link

@kleviscipi did you find a solution for that ?

@manish-sh14
Copy link

This is an open issue still we are facing. Did any update happen on this?

@kleviscipi
Copy link
Author

@manish-sh14 @SarahAlAshwal

I'm using the prop inputComponent to generate an element (input) by my self with default date values and i'm not using the clear features.

Something like this:

            <DatePicker 
                onChange= {this.onChange}
                locale="it"
                portal={this.props.portal||false}
                icon={this.getIcon()}
                placeholder={this.props.placeholder||""}
                inputComponent={(props)=>{
                    let newProps = props

                    if(!this.getValue()){
                            newProps.value = ""
                    }

                    if( this.state.value && this.getValue() ){
                        newProps.value = this.state.value
                    }
                    return <input type="text" className="form-control" {...newProps} />
                }}
                initialDate={this.props.initialDate}
            />

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

No branches or pull requests

3 participants