【问题标题】:Events not getting displayed at the right position事件没有显示在正确的位置
【发布时间】:2020-11-04 12:22:12
【问题描述】:

版本 - “react-big-calendar”:“^0.28.2”

-

附上截图

请在下面找到 React 代码 -

<Calendar
        defaultDate={moment().toDate()}
        defaultView="month"
        events={[{
          "status": "pending",
          start: new Date(2020, 10, 11, 10, 0),
          end: new Date(2020, 10, 11, 17, 0),
          "title": "Michael Scott",
          'allDay': false,
        }]}
        localizer={localizer}
        max={new Date(0, 0, 0, 21, 0, 0)}
        min={new Date(0, 0, 0, 7, 0, 0)}
        resizable
        selectable
        style={{ height: '80vh' }}
          />

【问题讨论】:

    标签: javascript html reactjs calendar react-big-calendar


    【解决方案1】:

    您需要在 Obj "events" 中按时刻格式化您的日期。示例:

    events={[{
      "status": "pending",
      start: moment().toDate(new Date(2020, 10, 11, 10, 0)),
      end: moment().toDate(new Date(2020, 10, 11, 17, 0)),
      "title": "Michael Scott",
      'allDay': false,
    }]}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-08
      • 1970-01-01
      • 2016-02-21
      • 1970-01-01
      相关资源
      最近更新 更多