Run setYearMonth on calendar

I would be very grateful if someone could help me with this issue:

Using React.

I’m trying to capture birth dates which are in the past so I need the datepicker to open up on a date in the past. By default it opens up on today’s date which makes for bad user experience.

I have this code:

useEffect(() => {

        const calendar = f7.calendar.get('#id-12345');
            calendar.on('open', (cal) => {
                cal.setYearMonth(2016, 1, 0);
                cal.update();
            });

            return () => calendar.off('open');

}, []);

return (

        <ListInput
            inputId="id-12345"
            type="datepicker"
           ...

In useEffect calendar is undefined. How do I get an instance of the calendar so that I may call seYearMonth on it?

So I found an answer (maybe there are others):

calendarParams: {
            on: {
                opened: function (cal: Calendar.Calendar) {
                    cal.setYearMonth(2016, 1, 0);
                    cal.update();
                }
            }
        }

The above solution does not work properly. When I set on opened on calendarParams then onCalendarChange does not fire. So I must then add change to on as well (and I have not tested that the other events fire):

calendarParams: {
            on: {
                opened: function (cal: Calendar.Calendar) {
                    cal.setYearMonth(2016, 1, 0);
                    cal.update();
                }
            },
            change: (calendar: Calendar.Calendar, value: unknown) => {

                    onChange(value);

                }
        }