Fullcalendar.io - 从 json 突出显示的错误日期范围
Fullcalendar.io - wrong date range highlighted from json
我在日历中显示事件时遇到问题。我正在从 events.json 文件中获取数据并添加一个事件。它显示一天对我来说太短了。例如,事件 09.08-15.08 只显示到 14.08。
08.09-09.10 是正确的,
24.09-26.09 太短了
01.09-05.09 太短等
为什么会这样?以及如何修复它?
这里是问题的实时预览:https://mawk.bieda.it/
这是我的代码:
<script>
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
/*locale: 'pl',*/
firstDay: 1,
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'prevYear,nextYear'
},
validRange: {
start: '2021-01-01',
end: '2022-01-01'
},
selectable: true,
select: function (info) {
alert('Selected ' + info.startStr + ' to ' + info.endStr);
},
events: {
url: '/events.json',
extraParams: function () {
return {
cachebuster: new Date().valueOf()
};
}
},
});
calendar.render();
});
</script>
<div id='calendar' style="height: 600px; width: 600px; margin: auto;"></div>
这是event.json:
[
{
"title": "09.08-15.08",
"start": "2021-08-09",
"end": "2021-08-15"
},
{
"title": "08.09-09.10",
"start": "2021-09-08",
"end": "2021-09-10"
},
{
"title": "24.09-26.09",
"start": "2021-09-24",
"end": "2021-09-26"
},
{
"title": "01.09-05.09",
"start": "2021-09-01",
"end": "2021-09-05"
},
{
"title": "28.09-03.10",
"start": "2021-09-28",
"end": "2021-10-03"
},
{
"title": "01.12-03.10",
"start": "2021-12-01",
"end": "2021-12-31"
}
]
根据官方文档:
因此,如果您希望它表现得好像结束日期包含在内,您必须将结束日期设置为一天后。
我在日历中显示事件时遇到问题。我正在从 events.json 文件中获取数据并添加一个事件。它显示一天对我来说太短了。例如,事件 09.08-15.08 只显示到 14.08。 08.09-09.10 是正确的, 24.09-26.09 太短了 01.09-05.09 太短等
为什么会这样?以及如何修复它?
这里是问题的实时预览:https://mawk.bieda.it/
这是我的代码:
<script>
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
/*locale: 'pl',*/
firstDay: 1,
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'prevYear,nextYear'
},
validRange: {
start: '2021-01-01',
end: '2022-01-01'
},
selectable: true,
select: function (info) {
alert('Selected ' + info.startStr + ' to ' + info.endStr);
},
events: {
url: '/events.json',
extraParams: function () {
return {
cachebuster: new Date().valueOf()
};
}
},
});
calendar.render();
});
</script>
<div id='calendar' style="height: 600px; width: 600px; margin: auto;"></div>
这是event.json:
[
{
"title": "09.08-15.08",
"start": "2021-08-09",
"end": "2021-08-15"
},
{
"title": "08.09-09.10",
"start": "2021-09-08",
"end": "2021-09-10"
},
{
"title": "24.09-26.09",
"start": "2021-09-24",
"end": "2021-09-26"
},
{
"title": "01.09-05.09",
"start": "2021-09-01",
"end": "2021-09-05"
},
{
"title": "28.09-03.10",
"start": "2021-09-28",
"end": "2021-10-03"
},
{
"title": "01.12-03.10",
"start": "2021-12-01",
"end": "2021-12-31"
}
]
根据官方文档:
因此,如果您希望它表现得好像结束日期包含在内,您必须将结束日期设置为一天后。