Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

If you set daysOfWeeks, minDate / maxDate isn't honored. And fix the minDate / maxDate examples. #136

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/basic/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ class Basic extends Component {
<div className="col-xs-12">
minDate and maxDate
<DateTimeField
maxDate={moment().add(1, "days")}
minDate={moment().subtract(1, "days")}
minDate={moment()}
maxDate={moment().add(5, "days")}
/>
<pre> {'<DateTimeField daysOfWeekDisabled={[0,1,2]} />'} </pre>
<pre> {'<DateTimeField minDate={moment()} maxDate={moment().add(5, "days")} />'} </pre>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously this was not the correct example. I replaced it with the right one.


</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/DateTimePickerDays.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export default class DateTimePickerDays extends Component {
}
if ((minDate && prevMonth.isBefore(minDate)) || (maxDate && prevMonth.isAfter(maxDate))) {
classes.disabled = true;
} else if (this.props.daysOfWeekDisabled.length > 0) {
classes.disabled = this.props.daysOfWeekDisabled.indexOf(prevMonth.day()) !== -1;
}
if (this.props.daysOfWeekDisabled.length > 0) classes.disabled = this.props.daysOfWeekDisabled.indexOf(prevMonth.day()) !== -1;
cells.push(<td className={classnames(classes)} key={prevMonth.month() + "-" + prevMonth.date()} onClick={this.props.setSelectedDate}>{prevMonth.date()}</td>);
if (prevMonth.weekday() === moment().endOf("week").weekday()) {
row = <tr key={prevMonth.month() + "-" + prevMonth.date()}>{cells}</tr>;
Expand Down