问题
I set my fullcalendar to have 15 minute slots, however it is not showing the minute breakouts.
For example, it will show 9am, 10am, 11am, etc. but not 9am, 9:15am, 9:30am, etc.
It shows the minute breakouts for other slots like 10 minutes, but I can't get it to work for 15.
I've looked around and saw this post: How to show all text on the axis for each minute slots rather than just 6am, 7am etc
but I can't find the function that user is referring to in his proposed resolution. Perhaps the script was updated since then.
Does anyone know how I can get the minute breakouts to show?
回答1:
I know it has been a long time but for anyone who has the same problem you can try using:
slotDuration: '00:15:00',
slotLabelInterval: 15,
slotLabelFormat: 'h(:mm)a',
in fullcalendar v2
回答2:
You should initialize your calendar like the example below. Please see my jsfiddle example for your solution. https://jsfiddle.net/ahmetyildirim/pk7na5jL/
It works with Fullcalendar v3.2.0.
$(document).ready(function() {
$('#calendar').fullCalendar({
weekends: false, // will hide Saturdays and Sundays
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaWeek,month,agendaDay'
},
defaultView: "agendaWeek",
businessHours: {
// days of week. an array of zero-based day of week integers (0=Sunday)
dow: [1, 2, 3, 4, 5], // Monday - Friday
start: '08:00', // a start time (8am in this example)
end: '18:00' // an end time (6pm in this example)
},
minTime: '06:30:00',
maxTime: '19:30:00',
slotDuration: '00:15:00',
slotLabelInterval: 15,
slotLabelFormat: 'h(:mm)a',
defaultDate: '2016-01-12',
slotMinutes: 15,
events: [{
title: 'test',
start: '2016-01-11T09:30:00',
end: '2016-01-11T12:30:00'
}]
});
});
回答3:
I figured it out. While using the fullcalendar.min.js if you comment out:
u=h.getMinutes();
it will show the minutes properly on the Y axis. I couldn't find where it was since the other post I linked above wasn't using the "min" version of the script file.
回答4:
I couldn't find the line stated by @Cineno. Instead I edited this line:
th class='fc-agenda-axis "+u+"'>"+(!ya||!ja?D(w,y("axisFormat")):"& nbsp;"+D(w,y("axisFormat")))+"/th>
by adding +D(w,y("axisFormat"))) after & nbsp;
Works for me.
回答5:
To make it work, i need to change
((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : ' ') +
to
((!minutes) ? formatDate(d, opt('axisFormat')) : "<small>" + formatDate(d, ':mm') + "</small>") +
I'll say the best way is to add an option ex. "axisSlotFormat"
回答6:
are you implementing agendaWeek, agendaDay?
header: {
left: 'title',
center: '',
right: 'prev,today,next,month,agendaWeek,agendaDay'
},
Thanks
来源:https://stackoverflow.com/questions/21142682/fullcalendar-not-showing-axis-times-for-15-min-slots