Fullcalendar v5在dayGridMonth的第一天无法正常工作 [英] Fullcalendar v5 first day in dayGridMonth not working
问题描述
我想先设置当前日期.但这不起作用.文档 https://fullcalendar.io/docs/view-object
I want set current date visible first. But it isn't working. Documentation https://fullcalendar.io/docs/view-object
var calendarAll = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
left: 'today',
center: 'prev,title,next',
right: 'month30,dayGridMonth,timeGridWeek'
},
initialView: 'month30',
views: {
month30: {
type: 'dayGridMonth',
buttonText: 'month30',
//activeStart: new Date(), //Not working
visibleRange: function(currentDate) {
var startDate = new Date(currentDate.valueOf());
var endDate = new Date(currentDate.valueOf());
startDate.setDate(startDate.getDate() - 1);
endDate.setDate(endDate.getDate() + 29);
return { start: startDate, end: endDate };
}
}
},
});
我该如何解决?Fullcalendar v5,没有jquery.
How can I fix it? Fullcalendar v5, without jquery.
推荐答案
月"fullCalendar提供的视图没有这种灵活性-它总是像传统的纸质日历一样在月初开始.恕我直言,如果外观不同,这会使许多用户感到困惑.
The "month" view provided by fullCalendar does not have this flexibility - it always starts at the beginning of the month, like a traditional paper calendar. IMHO it would be confusing to many users if it appeared differently.
其他类型的视图更灵活-如果您未在视图名称中指定时间范围,例如您指定了 timeGrid
visibleRange 设置>而不是 timeGridWeek
.
Other types of view are more flexible - they will respond to the visibleRange
setting if you do not specify the time range in the view name, such as if you specify timeGrid
rather than timeGridWeek
for example.
这篇关于Fullcalendar v5在dayGridMonth的第一天无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!