显示两个月之间的事件时出错
Error displaying an event between two months
我在使用 nextDayThreshold
选项时遇到问题。即使我将它设置为“08:00:00”,FullCalendar
也会复制在每月 1 号的“07:00:00”结束的事件,并在 [= 中用左箭头显示它13=],显示两个月内的同一事件:
$(function() { // document ready
$('#calendar').fullCalendar({
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nextDayThreshold: '08:00:00',
header: {
left: 'today prev,next',
center: 'title',
right: 'timelineMonth'
},
defaultView: 'timelineMonth',
resourceColumns: [
{
labelText: 'first column',
field: 'title',
width: 150
}
],
resources: [{
id: 'a',
title: 'Auditorium A',
}, {
id: 'b',
title: 'Auditorium B',
eventColor: 'green'
}, {
id: 'c',
title: 'Auditorium C',
eventColor: 'orange'
}],
events: [{
id: '1',
resourceId: 'b',
start: '2018-10-31T21:00:00',
end: '2018-11-01T07:00:00',
title: 'event 1'
}]
});
});
这是一个错误吗?
简答:不,这不是错误。
长答案:
documentation for nextDayThreshold 表示:
Only affects timed events that appear on whole-days. Whole-day cells
occur in month view, basicDay, basicWeek and the all-day slots in the
agenda views.
在 "timeline" 视图中,即使 slotDuration 在 "timelineMonth" 视图中默认设置为 1 天,fullCalendar 仍然将这些视为 timed插槽,而不是 whole-day 个单元格。因此 nextDayThreshold 规则不适用。例如如果您更改为 timelineWeek 视图,它仍然使用完全相同的布局和插槽,只是插槽的长度不同。它们不是另一种细胞。
如果我们查看您的 fiddle 的更新版本:https://jsfiddle.net/q2fk57nb/6/ 现在包含常规 "month" 视图(我只是将 right: 'timelineMonth,month'
添加到 header) 我们可以看到该视图中的同一事件仅限于 10 月 31 日,因为 nextDayThreshold 规则以及常规 "month" 视图使用 "whole-day" 个单元格的事实。
我在使用 nextDayThreshold
选项时遇到问题。即使我将它设置为“08:00:00”,FullCalendar
也会复制在每月 1 号的“07:00:00”结束的事件,并在 [= 中用左箭头显示它13=],显示两个月内的同一事件:
$(function() { // document ready
$('#calendar').fullCalendar({
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nextDayThreshold: '08:00:00',
header: {
left: 'today prev,next',
center: 'title',
right: 'timelineMonth'
},
defaultView: 'timelineMonth',
resourceColumns: [
{
labelText: 'first column',
field: 'title',
width: 150
}
],
resources: [{
id: 'a',
title: 'Auditorium A',
}, {
id: 'b',
title: 'Auditorium B',
eventColor: 'green'
}, {
id: 'c',
title: 'Auditorium C',
eventColor: 'orange'
}],
events: [{
id: '1',
resourceId: 'b',
start: '2018-10-31T21:00:00',
end: '2018-11-01T07:00:00',
title: 'event 1'
}]
});
});
这是一个错误吗?
简答:不,这不是错误。
长答案: documentation for nextDayThreshold 表示:
Only affects timed events that appear on whole-days. Whole-day cells occur in month view, basicDay, basicWeek and the all-day slots in the agenda views.
在 "timeline" 视图中,即使 slotDuration 在 "timelineMonth" 视图中默认设置为 1 天,fullCalendar 仍然将这些视为 timed插槽,而不是 whole-day 个单元格。因此 nextDayThreshold 规则不适用。例如如果您更改为 timelineWeek 视图,它仍然使用完全相同的布局和插槽,只是插槽的长度不同。它们不是另一种细胞。
如果我们查看您的 fiddle 的更新版本:https://jsfiddle.net/q2fk57nb/6/ 现在包含常规 "month" 视图(我只是将 right: 'timelineMonth,month'
添加到 header) 我们可以看到该视图中的同一事件仅限于 10 月 31 日,因为 nextDayThreshold 规则以及常规 "month" 视图使用 "whole-day" 个单元格的事实。