FullCalendarUser
FullCalendarUser

Reputation: 1

How to set the business hours for fullCalender v2.2.5

I want to ensure the events displayed in the 'month view' is accordance to the event start and end date. However, I notice due to the default business hours set in fullCalendar (9am to 5pm), I am having problem to display the events in the 'month view'

Problem : For example, given two events (Non all day event) as configured below:

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

In the 'month view' for March Event A is displayed across 7, 8 and 9 March while Event B is only displayed across 7 and 8 March

Question: How can i set the business hours in full calendar from 0000 to 2359 so that I can override the default business hours from 0900 to 1700

I have tried the method as suggested in the fullCalendar documentation 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 ]
        }
}

However, I am still unable to emphasized the new businessHours. Is there a property that I need to set true in order to emphasized the new businessHours? Or am I totally doing it wrongly ?

Please advice. Thank you

Upvotes: 0

Views: 7450

Answers (2)

Valix85
Valix85

Reputation: 793

I think it's a bug, i try with last version and doesn't work, i try with this js and work http://eo14.com/static/fullcalendar/fullcalendar.js

a work example here

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

Personally i try with this code and work:

<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]
            }
        ]

    });

});

Upvotes: 1

Saeed Gatson
Saeed Gatson

Reputation: 517

Business Hours shouldn't effect the month view and by default are off. You can leave the setting out or set it to false like this businessHours: false

For your agenda views that do show time, you can effect what's shown by setting minTime and maxTime.

Upvotes: 3

Related Questions