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?