我正在开发一个事件 cms 并使用 fullCalendar.io 来显示事件。 我的事件只有日期,没有时间,我将信息存储在 mySQL 数据库中。 尽管我需要在显示日历时显示包含的结束日期,但我无法更改 mySQL 列格式或事件插入方法来向日期添加时间。 我将粘贴我的代码来展示它是如何工作的。
$('#calendar').fullCalendar({
header: {
left: 'prev,next,today',
center: 'title'
},
defaultView: 'month',
eventSources: [{
url: 'getJsonEvents',
type: 'POST',
success: function(data) {
},
error: function() {
},
color: '#2D4047',
textColor: 'white',
}]
});
存储日期的列是一个简单的 DATE mysql 列。
编辑: 需要明确的是,问题是我的事件于(例如)19 日结束,但在日历 View 上似乎于 18 日结束。
最佳答案
来自https://fullcalendar.io/docs/event_data/Event_Object/ :
"end"...is the moment immediately after the event has ended. For example, if the last full day of an event is Thursday, the exclusive end of the event will be 00:00:00 on Friday!
因此,如果您有全天事件,您只需将发送到 fullCalendar 的“end”参数值增加 1 天。这是一种非常常见的方法 - 例如,Google 日历的 API 就是采用同样的方式。
关于mysql - fullCalendar - 包括结束日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44368866/