完整日历时间间隔应为1小时,从6:30开始 [英] Full Calendar Time interval Should be 1 hour and start from 6:30

查看:219
本文介绍了完整日历时间间隔应为1小时,从6:30开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过。



要注意的最重要的是 slotDuration 上的 01 秒。没有这个,你将无法显示半小时。






解释为什么你需要+01秒:



FullCalendar支持半个小时或任何你想要的轴,但你需要做这个古怪的事情。原因在于源代码本身(查看 FullCalendar 2.3.1 ),从第5714行到第5719行:

 ((!slotNormal ||!minutes)? //如果不规则的广告时段或小时,则显示时间
'< span>'+ // for matchCellWidths
htmlEscape(slotDate.format(this.axisFormat))+
'< / span>':
''

现在, $ slotNormal 在第5701行定义,它是:

  var slotNormal = this.slotDuration。 asMinutes()%15 === 0; 

所以,如果你有30分钟的时间,该条件将为false,FullCalendar将不显示时间。本主题在此答案中有详细介绍。



另外一点评论:你是usin g FullCalendar v1.5.4这是真的很老,我建议你升级。如果您升级,请记住FullCalendar现在依靠 momentjs


I tried this implementation Full Calendar Implementation.

    $("#available_classes_calendar").fullCalendar({
        header: {
             left   : 'prev,next',
             center : 'title'
            },
        defaultView: 'agendaWeek',
        views:{
            agenda:{
                allDaySlot: false,
                minTime: "06:30:00",
                maxTime: "24:00:00",
                slotDuration: "00:60:00"
            }
        }
    });

In this all-day column should be start from 6:30am and interval slot should be 1 hour.

So all-days column should look like:

6:30 am 7:30 am 8:30 am . . . 11:30 pm

I tried lots of solution but not able to achieve this.

Please let me know if any other info is required to solve this.

Thanks

解决方案

Your issue is the place where you've put your options. It should be

$("#available_classes_calendar").fullCalendar({
    header: {
         left   : 'prev,next',
         center : 'title'
        },
    defaultView: 'agendaWeek',
    allDaySlot: false,
    minTime: "06:30:00",
    maxTime: "24:00:00",
    slotDuration: "06:00:01"
});

Regarding the display of 06:30, 07:30 and so on, on the vertical axis, you need to set the slotDuration: "06:30:01". Take a look at this jsfiddle.

The most important thing to notice is the 01 second on the slotDuration. Without this, you won't be able to display half hours.


Explanation as to why you need the "+01" second:

FullCalendar supports axis with half hours or whatever you want, but you need to do this quirky thing. The reason behind this is in the source code itself (view source for FullCalendar 2.3.1), from line 5714 to 5719:

((!slotNormal || !minutes) ? // if irregular slot duration, or on the hour, then display the time
    '<span>' + // for matchCellWidths
        htmlEscape(slotDate.format(this.axisFormat)) +
    '</span>' :
    ''

Now, $slotNormal is defined on line 5701 and is:

var slotNormal = this.slotDuration.asMinutes() % 15 === 0;

So, if you have a 30 minute slot time, the condition will be false and FullCalendar won't display the time. This subject is covered in depth in this answer.

One additional remark: You're using FullCalendar v1.5.4 which is really old and I advice you to upgrade. If you do upgrade, remember that FullCalendar now relies on .

这篇关于完整日历时间间隔应为1小时,从6:30开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆