Skip to content

Commit

Permalink
chore(ui-calendar): improve typing
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrTopi committed Jun 14, 2024
1 parent f6d3a5f commit 8e5f117
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/ui-calendar/src/Calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ class Calendar extends Component<CalendarProps, CalendarState> {
this.setState({ visibleMonth: newDate })
}

handleYearChange = (e: React.MouseEvent, year: number) => {
handleYearChange = (
e: React.SyntheticEvent<Element, Event>,
year: number
) => {
const { withYearPicker } = this.props
const { visibleMonth } = this.state
const newDate = visibleMonth.clone()
Expand Down Expand Up @@ -293,9 +296,15 @@ class Calendar extends Component<CalendarProps, CalendarState> {
renderLabel=""
assistiveText={withYearPicker.screenReaderLabel}
value={Number(visibleMonth.format('YYYY'))}
onChange={(e: any, { value }: any) =>
this.handleYearChange(e, Number(value))
}
onChange={(
e: React.SyntheticEvent<Element, Event>,
{
value
}: {
value?: string | number | undefined
id?: string | undefined
}
) => this.handleYearChange(e, Number(value))}
>
{yearList.map((year) => (
<SimpleSelect.Option key={year} id={`opt-${year}`} value={year}>
Expand Down

0 comments on commit 8e5f117

Please sign in to comment.