@@ -13,21 +13,25 @@ DateTimePickerDays = React.createClass({
1313 showToday : React . PropTypes . bool ,
1414 daysOfWeekDisabled : React . PropTypes . array ,
1515 setSelectedDate : React . PropTypes . func . isRequired ,
16- showMonths : React . PropTypes . func . isRequired
16+ showMonths : React . PropTypes . func . isRequired ,
17+ minDate : React . PropTypes . object ,
18+ maxDate : React . PropTypes . object
1719 } ,
1820 getDefaultProps : function ( ) {
1921 return {
2022 showToday : true
2123 } ;
2224 } ,
2325 renderDays : function ( ) {
24- var cells , classes , days , html , i , month , nextMonth , prevMonth , row , year , _i , _len , _ref ;
26+ var cells , classes , days , html , i , month , nextMonth , prevMonth , minDate , maxDate , row , year , _i , _len , _ref ;
2527 year = this . props . viewDate . year ( ) ;
2628 month = this . props . viewDate . month ( ) ;
2729 prevMonth = this . props . viewDate . clone ( ) . subtract ( 1 , "months" ) ;
2830 days = prevMonth . daysInMonth ( ) ;
2931 prevMonth . date ( days ) . startOf ( 'week' ) ;
3032 nextMonth = moment ( prevMonth ) . clone ( ) . add ( 42 , "d" ) ;
33+ minDate = this . props . minDate ? this . props . minDate . clone ( ) . subtract ( 1 , 'days' ) : this . props . minDate ;
34+ maxDate = this . props . maxDate ? this . props . maxDate . clone ( ) : this . props . maxDate ;
3135 html = [ ] ;
3236 cells = [ ] ;
3337 while ( prevMonth . isBefore ( nextMonth ) ) {
@@ -51,6 +55,9 @@ DateTimePickerDays = React.createClass({
5155 classes [ 'today' ] = true ;
5256 }
5357 }
58+ if ( ( minDate && prevMonth . isBefore ( minDate ) ) || ( maxDate && prevMonth . isAfter ( maxDate ) ) ) {
59+ classes [ 'disabled' ] = true ;
60+ }
5461 if ( this . props . daysOfWeekDisabled ) {
5562 _ref = this . props . daysOfWeekDisabled ;
5663 for ( _i = 0 , _len = _ref . length ; _i < _len ; _i ++ ) {
0 commit comments