Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
Added the 'unselectable' prop defaulting to 'false'.
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio.redondo committed Dec 7, 2017
1 parent b6a1f0c commit cb2b9ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ You can also provide additional configuration like
unselectDay={function(day){}}
onPrevClick={function(startDay, selectedDays){}} // called with the new startDay
onNextClick={function(startDay, selectedDays){}} // called with the new startDay
unselectable={false} // if true allows to unselect a date once it has been selected. Only works when multipleDaySelect={false}
format={'YYYY-MM-DD'} //format of dates that handled in selectDay and unselectDay functions
firstLineFormat={'ddd'} // format for the first line of the day button
secondLineFormat={'MMM D'} // format for the second line of the day button
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ class ReactWeeklyDayPicker extends React.Component {
}else{
if( day.isSame(this.state.selectedDays[0], 'day')){ //remove existed day
this.convertOutputUnselect(day);
this.setState({
selectedDays: []
})
this.convertOutput([])
if(this.props.unselectable) {
this.setState({
selectedDays: []
})
this.convertOutput([])
}
}else{
this.setState({
selectedDays: [day]
Expand Down

0 comments on commit cb2b9ef

Please sign in to comment.