默认视图设为 agendaWeek 。如果我在晚上11:59加载fullCalendar,则今天日插槽在12:00 AM之后不会自动更新,直到我刷新浏览器。
答案 0 :(得分:0)
这就是我修复它的方法:
每5分钟(或任何适合您要求的间隔)调用一个函数
$(function() {
var tInterval = 5*60*1000;
timelineInterval = window.setInterval(updateFcToday, tInterval); // Update timeline after every 5 minutes
});
将这样的函数添加到包含日历的页面中:
function updateFcToday() {
var curTime = new Date();
if(curTime.getHours() == 0 && curTime.getMinutes() <= 5) // this five minutes is same interval that we are calling this function for. Both should be the same
{// the day has changed
var todayElem = $(".fc-today");
todayElem.removeClass("fc-today");
todayElem.removeClass("fc-state-highlight");
todayElem.next().addClass("fc-today");
todayElem.next().addClass("fc-state-highlight");
}
}