首页 > 解决方案 > Fullcalendar Now() 指标定位错误

问题描述

在 Fullcalendar 中,设置参数时

分钟时间

最大时间

Now() 指标未正确定位。

我有一个JSFiddle来显示这个问题。在这个小提琴中,我希望指标处于当前日期和时间,但它位于“昨天”列的顶部

下面是小提琴中使用的代码

HTML

<div id="calendar"></div>

Javascript

$('#calendar').fullCalendar({
    defaultView: 'agendaWeek',
    height: 600,
    nowIndicator: 'true',
    minTime: "20:00:00", // this makes the calendar start at 8PM
    maxTime: "44:00:00", // this makes the calender end 24 hours later at 8PM ( (8PM => 20) + 24 = 44)
    schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives'
})

删除

最小时间

最大时间

参数,使 Now 指标位置正确,如此处所示 https://jsfiddle.net/8jndrp7m/2/

使用 minTime 和 maxTime 时如何正确定位 Now 指示器?或者这是一个错误?

标签: javascriptfullcalendar

解决方案


i see multiple problems:

  1. the now indicator doesn't need quotes, change 'true' to true,
  2. If you want to extend the maxtime past midnight you can just put a 1. in front of the time, to set times the next day.So 8 in the morning on next day would be maxTime: '1.08:00:00'
  3. If you start the calendar at 8 in the evening and its not 8pm yet (at least in my timezone) the now indicator will not show properly

推荐阅读