@@ -13,21 +13,25 @@ DateTimePickerDays = React.createClass({
13
13
showToday : React . PropTypes . bool ,
14
14
daysOfWeekDisabled : React . PropTypes . array ,
15
15
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
17
19
} ,
18
20
getDefaultProps : function ( ) {
19
21
return {
20
22
showToday : true
21
23
} ;
22
24
} ,
23
25
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 ;
25
27
year = this . props . viewDate . year ( ) ;
26
28
month = this . props . viewDate . month ( ) ;
27
29
prevMonth = this . props . viewDate . clone ( ) . subtract ( 1 , "months" ) ;
28
30
days = prevMonth . daysInMonth ( ) ;
29
31
prevMonth . date ( days ) . startOf ( 'week' ) ;
30
32
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 ;
31
35
html = [ ] ;
32
36
cells = [ ] ;
33
37
while ( prevMonth . isBefore ( nextMonth ) ) {
@@ -51,6 +55,9 @@ DateTimePickerDays = React.createClass({
51
55
classes [ 'today' ] = true ;
52
56
}
53
57
}
58
+ if ( ( minDate && prevMonth . isBefore ( minDate ) ) || ( maxDate && prevMonth . isAfter ( maxDate ) ) ) {
59
+ classes [ 'disabled' ] = true ;
60
+ }
54
61
if ( this . props . daysOfWeekDisabled ) {
55
62
_ref = this . props . daysOfWeekDisabled ;
56
63
for ( _i = 0 , _len = _ref . length ; _i < _len ; _i ++ ) {
0 commit comments