import React from 'react'; import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core'; export const CalendarMonthSelectableDate: React.FunctionComponent = () => { const [date, setDate] = React.useState(new Date(2020, 10, 24)); const onMonthChange = ( _event: React.MouseEvent | React.ChangeEvent | React.FormEvent | undefined, newDate: Date ) => { // eslint-disable-next-line no-console console.log(`updated month: ${newDate.getMonth()}, updated year: ${newDate.getFullYear()}`); }; const inlineProps: CalendarMonthInlineProps = { component: 'article', title: ( Select your favorite date ), ariaLabelledby: 'favorite-date' }; return ( <> , date: Date) => setDate(date)} onMonthChange={onMonthChange} inlineProps={inlineProps} />
Selected date: {date.toString()}
); };