| 1 |
import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core'; |
| 2 |
|
| 3 |
export const CalendarMonthDateRange: React.FunctionComponent = () => { |
| 4 |
const startDate = new Date(2020, 10, 11); |
| 5 |
const endDate = new Date(2020, 10, 24); |
| 6 |
const disablePreStartDates = (date: Date) => date >= startDate; |
| 7 |
|
| 8 |
const inlineProps: CalendarMonthInlineProps = { |
| 9 |
component: 'article', |
| 10 |
title: ( |
| 11 |
<Title id="display-range" headingLevel="h4"> |
| 12 |
Calendar month displaying a range |
| 13 |
</Title> |
| 14 |
), |
| 15 |
ariaLabelledby: 'display-range' |
| 16 |
}; |
| 17 |
|
| 18 |
return ( |
| 19 |
<CalendarMonth |
| 20 |
validators={[disablePreStartDates]} |
| 21 |
date={endDate} |
| 22 |
rangeStart={startDate} |
| 23 |
inlineProps={inlineProps} |
| 24 |
/> |
| 25 |
); |
| 26 |
}; |