Ideally, you should make this a feature request. But here's a hacky method.
Fudge the time slot labels
On viewRender
, grab the slot labels and add an offset to them:
viewRender: function (view, element) {
if (view.name.indexOf("timeline") > -1) { //if it's a timeline view
$(element).find(".fc-chrono .fc-cell-text").each(
function (i, cell) {
var old = moment($(cell).text(), "ha"); //grab and parse old time label
$(cell).text(old.add(OFFSET, 'h').format("ha")); //add an offset
}
);
}
},
And set minTime
. Remember that there is an offset.
minTime: "15:00:00", //is actually 15h + offset
JSFiddle
Problems
Naturally this cause some issues.
- It only changes the labels. FC still thinks that the place labeled
5am
is midnight.
- Server sync issues. You either have to store offset dates or transform them from the server and to the server.
- The day labels might not be exactly what you want. They will show something like
10pm - 4am
as the same day.
Helper Functions
Something like this will be useful. Convert an event to an offset event and back again.
var offset = {
_offset: 6, //in hours
_apply: function(moments,op){ //sub/add offset from moment array, with null checks
for(var i = 0; i < moments.length; i++){
if(moment.isMoment(moments[i]))
moments[i][op](this._offset,'h');
}
},
get: function(){
return this._offset;
},
//Add the offset to the event or moment
//Real time/display time -> offset timeline time
add: function(event){
this._apply([event,event.start,event.end],'subtract');
return event;
},
//Remove the offset to the event or moment
//Offset timeline time -> real time/display time
remove: function(event){
this._apply([event,event.start,event.end],'add');
return event;
}
};