Fullcalendar Now()指示器位置错误

时间:2019-03-13 12:23:24

标签: javascript fullcalendar

在Fullcalendar中,设置参数

  

mintime

  

maxtime

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'
})

删除

  

minTime

  

maxTime

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

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

2 个答案:

答案 0 :(得分:1)

我看到多个问题:

  1. 现在指示器不需要引号,将'true'更改为true
  2. 如果您想将maxtime延长至午夜之后,您可以在时间前面加一个1.来设置第二天的时间。因此,第二天早上8点将是maxTime: '1.08:00:00'
  3. 如果您从晚上8点开始日历,并且还没有到晚上8点(至少在我所在的时区),现在指示将无法正确显示

答案 1 :(得分:0)

问题看起来像您为第二天设置了maxTime,为什么它不起作用

如果您想指定日期以设置最大日期,请使用validRange设置最小和最大日期

$('#calendar').fullCalendar({
        defaultView: 'agendaWeek', //agendaWeek
        validRange: {
          start: '2017-05-01',
          end: '2017-06-01'
        },
        locale: 'nl',
        timezone: 'local',
        themeSystem: 'bootstrap3',
        height: 600,
        slotDuration: '00:10:00',
        nowIndicator: 'true',
       minTime: "17:00:00", // this makes the calendar start at 8PM
       maxTime: "20:00:00", // this makes the calender end 24 hours later at 8PM ( (8PM => 20) + 24 = 44) 
        schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
        editable: true, // enable draggable events
        droppable: true, // this allows things to be dropped onto the calendar
    })
相关问题