diff --git a/README.md b/README.md index 35ccf10..4c792df 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ http://wangzuo.github.io/input-moment hourStep={1} // default prevMonthIcon="ion-ios-arrow-left" // default nextMonthIcon="ion-ios-arrow-right" // default + minDate={this.state.minDate} // optional + maxDate={this.state.maxDate} // optional /> ``` Check [app.js](https://github.com/wangzuo/input-moment/blob/master/example/app.js) for a working example. diff --git a/__tests__/__snapshots__/input-moment.js.snap b/__tests__/__snapshots__/input-moment.js.snap index 0f140b7..a382ab1 100644 --- a/__tests__/__snapshots__/input-moment.js.snap +++ b/__tests__/__snapshots__/input-moment.js.snap @@ -33,6 +33,7 @@ exports[`render 1`] = ` > {m.format('MMMM YYYY')} - @@ -75,14 +202,18 @@ export default class Calendar extends Component { {chunk(days, 7).map((row, w) => - {row.map(i => - { + return this.selectDate(i, w)} + minDate={minDate} + maxDate={maxDate} + currentMoment={m} /> + } )} )} diff --git a/src/input-moment.js b/src/input-moment.js index a8b35c0..b313ff7 100644 --- a/src/input-moment.js +++ b/src/input-moment.js @@ -9,7 +9,9 @@ export default class InputMoment extends Component { prevMonthIcon: 'ion-ios-arrow-left', nextMonthIcon: 'ion-ios-arrow-right', minStep: 1, - hourStep: 1 + hourStep: 1, + minDate: null, + maxDate: null }; state = { @@ -36,6 +38,8 @@ export default class InputMoment extends Component { minStep, hourStep, onSave, + minDate, + maxDate, ...props } = this.props; const cls = cx('m-input-moment', className); @@ -66,6 +70,8 @@ export default class InputMoment extends Component { onChange={this.props.onChange} prevMonthIcon={this.props.prevMonthIcon} nextMonthIcon={this.props.nextMonthIcon} + minDate={this.props.minDate} + maxDate={this.props.maxDate} />