Skip to content

Commit

Permalink
v1.0.7 (onConfirm would return start and end date)
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis committed Apr 25, 2018
1 parent f9820b0 commit b383a8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{
"name": "react-native-date-ranges",
"version": "1.0.6",
"version": "1.0.7",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions src/DateRangeWarpper.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ export default class DateRangePickerView extends Component {
this.setState({ modalVisible: visible });
}
onConfirm = () => {
if(typeof this.props.onConfirm === 'function'){
this.props.onConfirm();
}

if(this.state.startDate && this.state.endDate){
const start = this.state.startDate.format('LL');
const end = this.state.endDate.format('LL');
this.setState({showContent:true, selected:`${start} → ${end}`});
this.setModalVisible(false);

if(typeof this.props.onConfirm === 'function'){
this.props.onConfirm({startDate:start, endDate:end});
}
}
else{
alert('please select correct date');
Expand Down

0 comments on commit b383a8a

Please sign in to comment.