Reputation: 17
I have a MUI static date picker looking as following:
How can i detect clicks on the arrows in order to fire a function? I have a calendar next to this component - and i want to show the corresponding month to the datepicker.
I'm new to this, so pardon me for asking for something that is not possible.
import { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker';
Upvotes: 0
Views: 170
Reputation: 1721
You can try using onMonthChange
property to listen for changes in a month. The callback returns Date string which you can convert to a date object:
<StaticDatePicker onMonthChange={(date) => {
console.log(new Date(date).getMonth())
}}/>
Upvotes: 1