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

Updating ranges prop does not update the date ranger picker UI #215

Closed
rehanumar opened this issue Jan 14, 2020 · 3 comments
Closed

Updating ranges prop does not update the date ranger picker UI #215

rehanumar opened this issue Jan 14, 2020 · 3 comments

Comments

@rehanumar
Copy link
Contributor

I am updating the ranges prop with latest props object from store but in UI initial props object is displayed. So my hypothesis is that updating the ranges props does not sync with UI.
I have debugged this through the React Dev Tool and DateRangePicker component have latest props in the format mentioned in http://www.daterangepicker.com/#example4.

<DateRangePicker
                startDate={moment(startDate)}
                endDate={moment(endDate)}
                maxDate={moment()}
                ranges={dateRanges}
                autoApply={true}
                opens="left"
                onApply={this.onApplyHandler}
              >

where old value of dateRanges={'Activity1': [moment(StartDate), moment(EndDate)]}
and new value of dateRanges={'Activity2': [moment(StartDate), moment(EndDate)]}

@rehanumar
Copy link
Contributor Author

@skratchdot and others, following is the link to fix of this issue.
#216

@vidhi6891
Copy link

Hello, is the above PR merged ? I am facing the same issue wherein the calendar is not re-re dering on a change in the ranges prop

@skratchdot
Copy link
Owner

Please see this comment on how to change props like "range":

#216 (comment)

The only props you should treat as "controlled props" are startDate and endDate. All others should be treated as "initial" values only. I will try to release a new version (v6) with a completely changed api to make this more clear (and some better examples)

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