议程日期行格式在fullCalendar中 [英] agendaDay row time format in fullCalendar

查看:93
本文介绍了议程日期行格式在fullCalendar中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将日历行中的时间格式设置为1pm - 2pm,2pm - 3pm,3pm - 4pm等。

我尝试过如下所示:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' mm { - h:mm}',
day:'h:mm { - h:mm}',
axisFormat:'h(:mm)tt',
timeFormat:{
议程:'h:mm { - h:mm}'
},

但以上都没有,无论是单独或组合似乎为我工作。



我初始化我的日历如下:

  $('#calendar')。fullCalendar({
defaultView:'agendaDay',
allDaySlot:false,
firstHour:9 ,
minTime:9,
maxTime:19,
可选:true,
unselectAuto:true,
slotMinutes:60,
周末:假,
year:current_year,
month:current_month,
date:current_day,
columnFormat:'',


axisFormat 提供一个to时间,因此 { - h:mm}

如果您不想编辑FullCalendar源代码,可以采取任何方法。



但是,如果您觉得冒险,可以在 fullcalendar中进行以下更改.js 在第3207行左右:

  d = zeroDate(); 
maxd = addMinutes(cloneDate(d),maxMinute);
addMinutes(d,minMinute);

//添加两行
var toD = cloneDate(d);
addMinutes(toD,opt('slotMinutes'));

slotCnt = 0;
for(i = 0; d< maxd; i ++){
分钟= d.getMinutes();
s + =
< tr class ='fc-slot+ i +''+(!minutes?'':'fc-minor')+'> +
< th class ='fc-agenda-axis+ headerClass +'> +

//将行从formatDate(d,opt('axisFormat')...)更改为formatDates(d,toD,opt('axisFormat')...)
$($!slotNormal ||!minutes)?formatDates(d,toD,opt('axisFormat')):'& nbsp;')+

< / th> +
< td class ='+ contentClass +'> +
< div style ='position:relative'>& nbsp;< / div> +
< / td> +
< / tr>;
addMinutes(d,opt('slotMinutes'));

//添加行
addMinutes(toD,opt('slotMinutes'));

slotCnt ++;
}


I am trying to set the time format in my calendar rows to appear as 1pm - 2pm, 2pm - 3pm, 3pm- 4pm, etc.

I have tried the following:

agenda: 'h:mm{ - h:mm}',
axisFormat: 'h:mm{ - h:mm}',  
day: 'h:mm{ - h:mm}', 
axisFormat: 'h(:mm)tt', 
timeFormat: {
    agenda: 'h:mm{ - h:mm}'
},

but none of the above, either alone or in combination seem to work for me.

I initialize my calendar as below:

  $('#calendar').fullCalendar({
    defaultView: 'agendaDay',
    allDaySlot: false,
    firstHour: 9,
    minTime: 9,
    maxTime: 19,
    selectable: true,
    unselectAuto: true,
    slotMinutes: 60,
    weekends: false,
    year: current_year,
    month: current_month,
    date: current_day,
    columnFormat: '',

解决方案

FullCalendar does not provide a "to" time for the axisFormat and therefore the { - h:mm} part of you axisFormat is ignored.

And I don't think there's any way to do it without editing the FullCalendar source code.

But if you are feeling adventurous you could do the following changes in fullcalendar.js around line 3207:

    d = zeroDate();
    maxd = addMinutes(cloneDate(d), maxMinute);
    addMinutes(d, minMinute);

    // Add two lines
    var toD = cloneDate(d);
    addMinutes(toD, opt('slotMinutes'));

    slotCnt = 0;
    for (i=0; d < maxd; i++) {
        minutes = d.getMinutes();
        s +=
            "<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" +
            "<th class='fc-agenda-axis " + headerClass + "'>" +

            // Changed line from "formatDate(d, opt('axisFormat')...)" to "formatDates(d, toD, opt('axisFormat')...)"
            ((!slotNormal || !minutes) ? formatDates(d, toD, opt('axisFormat')) : '&nbsp;') +

            "</th>" +
            "<td class='" + contentClass + "'>" +
            "<div style='position:relative'>&nbsp;</div>" +
            "</td>" +
            "</tr>";
        addMinutes(d, opt('slotMinutes'));

        // Add line
        addMinutes(toD, opt('slotMinutes'));

        slotCnt++;
    }

这篇关于议程日期行格式在fullCalendar中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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