我想在dayGridMonth视图上显示事件的结束时间,但是当访问eventTimeFormat的对象时,键"end"没有值,这与timeGridWeek视图不同。
如何让 FullCalendar 在 dayGridMonth 视图中用值填充结束键?
对于日网格月视图
{
"date": {
"marker": "2019-09-20T10:30:00.000Z",
"timeZoneOffset": 480,
"array": [
2019,
8,
20,
10,
30,
0,
0
],
"year": 2019,
"month": 8,
"day": 20,
"hour": 10,
"minute": 30,
"second": 0,
"millisecond": 0
},
"start": {
"marker": "2019-09-20T10:30:00.000Z",
"timeZoneOffset": 480,
"array": [
2019,
8,
20,
10,
30,
0,
0
],
"year": 2019,
"month": 8,
"day": 20,
"hour": 10,
"minute": 30,
"second": 0,
"millisecond": 0
},
"end": null,
"timeZone": "local",
"localeCodes": [
"en"
]
}
对于时间网格周
{
"date": {
"marker": "2019-09-16T10:00:00.000Z",
"timeZoneOffset": 480,
"array": [
2019,
8,
16,
10,
0,
0,
0
],
"year": 2019,
"month": 8,
"day": 16,
"hour": 10,
"minute": 0,
"second": 0,
"millisecond": 0
},
"start": {
"marker": "2019-09-16T10:00:00.000Z",
"timeZoneOffset": 480,
"array": [
2019,
8,
16,
10,
0,
0,
0
],
"year": 2019,
"month": 8,
"day": 16,
"hour": 10,
"minute": 0,
"second": 0,
"millisecond": 0
},
"end": {
"marker": "2019-09-16T15:00:00.000Z",
"timeZoneOffset": 480,
"array": [
2019,
8,
16,
15,
0,
0,
0
],
"year": 2019,
"month": 8,
"day": 16,
"hour": 15,
"minute": 0,
"second": 0,
"millisecond": 0
},
"timeZone": "local",
"localeCodes": [
"en"
]
}
如果要在dayGrid(即"月"(视图中显示事件的结束时间,那么只需将displayEventEnd选项设置为true:
displayEventEnd: true
演示:https://codepen.io/ADyson82/pen/qBWQOMR?&editable=true&editors=001
(注目前还不清楚eventTimeFormat
与您的要求有何关系,或者您如何获得上面的输出,因为 eventTimeFormat 是您在设置时传递给 fullCalendar 的选项,用于告诉它您希望如何显示单个日期/时间(请注意您希望如何显示它,而不是您是否希望它显示(。这不是您通常希望在任何其他时间访问的值。由于您没有提供代码,因此在任何情况下都不清楚您如何、何地或何时访问该数据。无论哪种方式,它都不能帮助你实现你的目标。