如何设置fullCalendar v2.2.5的营业时间

时间:2015-01-08 06:39:51

标签: fullcalendar

我想确保'月视图'中显示的事件符合事件的开始和结束日期。但是,我注意到由于fullCalendar中设置的默认营业时间(上午9点到下午5点),我在“月视图”中显示事件时遇到问题

问题: 例如,给定两个事件(非全天事件),如下所示:

Event A >> 
Start Date : 7 March | Start Time : 2pm 
End Date : 9 March | End Time : 09:30am

Event B >> 
Start Date : 7 March | Start Time : 2pm 
End Date : 9 March | End Time : 08:30am

在三月份的“月份视图”中 事件A显示在3月7日,8日和9日 活动B仅在3月7日和8日展示

问题: 如何将完整日历中的营业时间设置为0000到2359,以便我可以覆盖从0900到1700的默认营业时间

我已尝试过fullCalendar文档中建议的方法 http://fullcalendar.io/docs/display/businessHours/

$(#calendarId).fullCalendar(
{
        theme: true,
        header:
        {
            left: 'prev,today,next',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },

        defaultView: 'month',
        eventColor: '#3485c1',
        height: 800,
        aspectRatio: 0.5,
        editable: true,
        selectable: true,
        events: arrayOfEventObj,
        eventLimit: true,
        timeFormat: '',

        businessHours:
        {
            start: '00:00', 
            end: '23:59',
            dow: [ 1, 2, 3, 4, 5, 6, 7 ]
        }
}

然而,我仍然无法强调新的业务时间。为了强调新的业务时间,我需要设置一个属性吗? 还是我完全错误地做错了?

请指教。谢谢

2 个答案:

答案 0 :(得分:3)

营业时间不应影响月份视图,默认情况下已关闭。您可以保留此设置或将其设置为false,如businessHours: false

对于显示时间的议程视图,您可以通过设置minTimemaxTime来实现所显示的内容。

答案 1 :(得分:1)

我认为这是一个错误,我尝试使用上一版本并且无法正常工作,我尝试使用这个js并且工作 http://eo14.com/static/fullcalendar/fullcalendar.js

这里的工作示例

http://eo14.com/static/fullcalendar/

我个人尝试使用此代码并开始工作:

<script>
var calendar="";
var _eventi="";
_eventi = [{events: <?PHP echo json_encode($orariServizio); ?>}];

$(document).ready(function() {

    calendar = $('#calendar').fullCalendar({
       //eventSources: _eventi,
       defaultDate: "2015-06-01",  
       lang:"it",
       //defaultTimedEventDuration: '04:00:00',
       height: 500,
       allDaySlot:false,
       header: {
           left:'',
           //center:'',
           right:'',
            //left: 'prev,next today',
            center: 'title',
            //right: 'month,basicWeek,basicDay'
        }, // buttons for switching between views
        //weekmode:"liquid",                     
        editable: true,
        selectable: true,
        selectHelper: true,            
        //eventLimit: true,
        selectConstraint: 'businessHours',
        eventConstraint: 'businessHours',        
        views: {
            settimana:{
                type:'agendaWeek',
                duration: { days: 7 },
                titleFormat: ' ', //YYYY
                //buttonText: '7 day',
                columnFormat: 'dddd',
                //hiddenDays: [0, 6] // Hide Sunday and Saturday?
            }
        },
        defaultView: 'settimana',
        businessHours:[ 
            {
                start: '09:00',
                end: '13:00',
                dow: [1, 2]
            },
            {
                start: '14:00',
                end: '16:00',
                dow: [1, 2]
            },
            {
                start: '10:00',
                end: '19:00',
                dow: [4]
            },
            {
                start: '06:00',
                end: '10:30',
                dow: [6]
            },
            {
                start: '13:00',
                end: '17:00',
                dow: [6]
            },
            {
                start: '20:00',
                end: '23:00',
                dow: [6]
            }
        ]

    });

});