|
1 | 1 | import React from 'react'; |
2 | 2 | import ReactDOM from 'react-dom/client'; |
3 | 3 | import './index.css'; |
4 | | -import { IgrCalendar, IgrCalendarModule, DateRangeDescriptor, DateRangeType } from 'igniteui-react'; |
| 4 | +import { IgrCalendar, DateRangeDescriptor, DateRangeType } from 'igniteui-react'; |
5 | 5 | import 'igniteui-webcomponents/themes/light/bootstrap.css'; |
6 | 6 |
|
7 | | -IgrCalendarModule.register(); |
8 | | - |
9 | 7 | export default class CalendarDisabledDates extends React.Component<any, any> { |
10 | 8 |
|
11 | | - //public disabledDates: DateRangeDescriptor[]; |
12 | | - |
13 | 9 | constructor(props: any) { |
14 | | - super(props); |
| 10 | + super(props); |
15 | 11 |
|
16 | 12 | const today = new Date(); |
17 | 13 | const range = [ |
18 | 14 | new Date(today.getFullYear(), today.getMonth(), 3), |
19 | 15 | new Date(today.getFullYear(), today.getMonth(), 8) |
20 | 16 | ]; |
21 | 17 |
|
22 | | - const desc: DateRangeDescriptor = new DateRangeDescriptor(); |
23 | | - desc.dateRange = range; |
24 | | - desc.rangeType = DateRangeType.Specific; |
25 | | - |
26 | | - const dates: DateRangeDescriptor[] = [desc]; |
| 18 | + const desc: DateRangeDescriptor = { |
| 19 | + dateRange: range, |
| 20 | + type: DateRangeType.Specific, |
| 21 | + } |
| 22 | + const disabledDates = [desc]; |
27 | 23 |
|
28 | | - this.state = { disabledDates: dates}; |
| 24 | + this.state = { disabledDates }; |
29 | 25 | } |
30 | 26 |
|
31 | 27 | public render(): JSX.Element { |
32 | 28 | return ( |
33 | 29 | <div className="container sample"> |
34 | | - <IgrCalendar disabledDates={this.state.disabledDates} style={{width: '400px'}}/> |
| 30 | + <IgrCalendar disabledDates={this.state.disabledDates} style={{width: '400px'}}/> |
35 | 31 | </div> |
36 | 32 | ); |
37 | 33 | } |
|
0 commit comments