与Angular 8一起使用FullCalendar,与timeGridWeek不同,dayGridMonth中的事件没有结束值

时间:2019-09-19 03:40:35

标签: angular fullcalendar fullcalendar-4

我想在dayGridMonth视图上显示事件的结束时间,但是,当访问eventTimeFormat对象时,键'end'没有值,与timeGridWeek视图不同。

如何让FullCalendar在dayGridMonth视图中用值填充结束键?

对于dayGridMonthView

{
  "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"
  ]
}

对于timeGridWeek

{
  "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"
  ]
}

1 个答案:

答案 0 :(得分:0)

如果您想在dayGrid(即“ month”)视图中显示事件的结束时间,则可以简单地将displayEventEnd选项设置为true:

displayEventEnd: true

演示:https://codepen.io/ADyson82/pen/qBWQOMR?&editable=true&editors=001

(NB尚不清楚eventTimeFormat与您的需求之间的关系,或者您如何获得上面的输出,因为eventTimeFormat是一个选项,您在设置它时会将其传递给fullCalendar,以告知它如何您希望显示一个单独的日期/时间(请注意如何显示,而不是是否显示)。这不是通常需要访问的值由于您未提供任何代码,因此无论如何,何时何地访问该数据都不清楚,无论哪种方式都无济于事。)