question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onDatesChange called before onClose

See original GitHub issue

On DateRangePicker after selecting your end date the picker closes. onDatesChange for the endDate selection is triggered after onClose. It seems onClose should really be the final call.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:10

github_iconTop GitHub Comments

2reactions
116050423commented, Jan 25, 2018

@meimei777 onClose() can get one parameter which is a object { startDate: moment{} endDate: moment{} } you can get it here.

0reactions
diego-cesacommented, Dec 17, 2018

As manu2784 mentioned, you can pass the dates as an object param to the onClose. You can use that instead of getting them from the this.state.

<DateRangePicker 
   onClose={({startDate, endDate})=>this.onClose({ startDate, endDate })}
/>

 onClose = (dates) => {
        console.log(dates)
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

onDatesChange called before onClose · Issue #532 - GitHub
onDatesChange for the endDate selection is triggered after onClose . It seems onClose should really be the final call.
Read more >
onClose, react-date-presets returns undefined startDate ...
I have to find a way to grab the updated startDate and endDate inside the onClose function also if i select one range....
Read more >
react-dates - npm
The DateRangePicker is a fully controlled component that allows users to select a date range. You can control the selected dates using the ......
Read more >
react-dates/CHANGELOG.md - UNPKG
39, - [fix] Pass correct props to SingleDatePicker on close (@AlokTakshak, ... 88, - [breaking] Call `onDatesChange` before `onFocusChange` in the DRP ...
Read more >
https://raw.githubusercontent.com/airbnb/react-dat...
... [fix] Pass correct props to SingleDatePicker on close (@AlokTakshak, ... 19.0.0 - [breaking] Call `onDatesChange` before `onFocusChange` in the DRP ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found