@@ -15,6 +15,7 @@ import { Async, css } from 'office-ui-fabric-react/lib/Utilities';
15
15
import { IDateTimePickerProps , IDateTimePickerState , DateTimePickerStrings } from "." ;
16
16
import { TimeHelper } from "./TimeHelper" ;
17
17
import { TimeDisplayControlType } from "./TimeDisplayControlType" ;
18
+ import { addMonths , addYears } from 'office-ui-fabric-react/lib/utilities/dateMath/DateMath' ;
18
19
19
20
interface IDateComponents {
20
21
day : Date ;
@@ -53,7 +54,8 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
53
54
hours,
54
55
minutes,
55
56
seconds,
56
- errorMessage : ''
57
+ errorMessage : '' ,
58
+ today : new Date ( Date . now ( ) )
57
59
} ;
58
60
59
61
this . async = new Async ( this ) ;
@@ -205,7 +207,9 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
205
207
strings : dateStrings = new DateTimePickerStrings ( ) , // Defines the DatePicker control labels
206
208
timeDisplayControlType,
207
209
placeholder,
208
- showLabels
210
+ showLabels,
211
+ minDate = addYears ( this . state . today , 1 ) ,
212
+ maxDate = addYears ( this . state . today , 1 )
209
213
} = this . props ;
210
214
211
215
const hours : number = value != null ? value . getHours ( ) : this . state . hours ;
@@ -293,6 +297,8 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
293
297
showMonthPickerAsOverlay = { showMonthPickerAsOverlay }
294
298
showWeekNumbers = { showWeekNumbers }
295
299
placeholder = { placeholder }
300
+ minDate = { minDate }
301
+ maxDate = { maxDate }
296
302
/>
297
303
</ div >
298
304
</ div >
0 commit comments