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

Add possibility to define disabled days #62

Merged
merged 19 commits into from
Aug 23, 2018
Merged

Conversation

kvolkovich-sc
Copy link
Contributor

API changes

Added new property modifiers.
Implemented default disabled modifier.
Disabled days validation and display for DateInput and DateRangeInput components can be implemented by validation at parent component level and passing validation result to isValid property.
For validation use import { ModifiersUtils } from @opuscapita/react-dates.
See component documentation for details.

@kvolkovich-sc kvolkovich-sc requested review from estambakio-sc and removed request for asergeev-sc August 22, 2018 20:06
handleDayClick = (value, modifiers) => {
if (!modifiers.disabled) {
this.handleDateChange(value);
this.setState({ showPicker: false });
Copy link
Contributor

Choose a reason for hiding this comment

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

Better be this.hidePicker(); instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

locale={'de'}
onChange={_scope.handleChange1.bind(_scope)}
value={_scope.state.value1}
disabledDays={{ after: new Date() }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Props reference and example don't match: modifiers vs. disabledDays.

@@ -32,7 +32,17 @@ See react-day-picker [methods reference](http://react-day-picker.js.org/APIMetho
<DayPicker
dayPickerRef={ref => (window.picker = ref)}
onChange={ day => console.log('day:', day) }
locale="de"
locale="en"
disabledDays={{ after: new Date() }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong naming? No such prop in prop types neither in component's code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No.

Changed to modifiers: { disabled: ... } Fixed.

import './DayPicker.less';
window.dayjs = dayjs;
Copy link
Contributor

Choose a reason for hiding this comment

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

Obsolete.

Kirill Volkovich added 2 commits August 23, 2018 15:48
showPicker: false
});
handleDayClick = (dayValue, modifiers) => {
if (!modifiers.disabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Better

if (modifiers.disabled) {
  return
}

... code

Kirill Volkovich added 2 commits August 23, 2018 15:56
@kvolkovich-sc kvolkovich-sc merged commit 24ff48f into master Aug 23, 2018
@kvolkovich-sc kvolkovich-sc deleted the issue-55-disabled-days branch August 23, 2018 13:07
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

Successfully merging this pull request may close these issues.

2 participants