gotoDate()无法在时间线视图中处理FullCalendar

gotoDate()无法在时间线视图中处理FullCalendar,fullcalendar,fullcalendar-5,Fullcalendar,Fullcalendar 5,我正在使用FullCalendar v5和@FullCalendar/react的时间线视图,我希望我的clanedar自动滚动到今天。当我调用.gotoDate()时,它什么也不做 这是我的日历代码: const calendarRef = useRef(); const getCalendarApi = () => { const {current} = calendarRef; return current?.getApi(); }; return ( &

我正在使用FullCalendar v5和
@FullCalendar/react
的时间线视图,我希望我的clanedar自动滚动到今天。当我调用
.gotoDate()
时,它什么也不做

这是我的日历代码:

const calendarRef = useRef();

const getCalendarApi = () => {
    const {current} = calendarRef;
    return current?.getApi();
};

return (
    <FullCalendar
        ref={calendarRef}
        timeZone="local"
        initialView="resourceTimelineMonth"
        ...
    />
);
当我点击“测试”按钮时,什么也没发生。我检查了calendarApi.gotoDate()是一个有效的函数,但它什么都没做。你知道为什么这样不行吗

更新#1: 我还尝试将
initialDate=“2021-03-23”
添加到
中,但它也没有任何作用

更新#2: 我尝试添加
validRange
,它的工作原理是滚动到开始日期,但现在它没有显示开始日期之前的任何事件

return (
    <FullCalendar
        ref={calendarRef}
        timeZone="local"
        initialView="resourceTimelineMonth"
        validRange={()=> {
            return {
                start: "2021-03-20",
                end: "2021-03-31"
            };
        }}
        ...
    />
);
返回(
{
返回{
开始:“2021-03-20”,
完:“2021-03-31”
};
}}
...
/>
);

您是否尝试在
新日期()中传递一个字符串?那么它有效吗?@maxshuty,你是说
calendarApi.gotoDate(“2021-03-23”)?我刚试过,但也没用(
gotoDate()
如有必要,可更改视图。如果请求的日期已在当前视图中,则不会执行任何操作。initialDate是相同的-如果日期已在默认视图中,则不会将其移动。FullCalendar不直接支持此操作。不知道其中任何一项是否在v5中仍然有效:您可能也需要请求一项功能,以便让它在未来得到充分支持,或者投票表决已经存在的一个:
return (
    <FullCalendar
        ref={calendarRef}
        timeZone="local"
        initialView="resourceTimelineMonth"
        validRange={()=> {
            return {
                start: "2021-03-20",
                end: "2021-03-31"
            };
        }}
        ...
    />
);