fullcalendar-在dayGridWeek中显示时间

时间:2019-05-29 12:54:33

标签: javascript fullcalendar fullcalendar-4

我使用全日历显示事件,但是有问题。如何在dayGridWeek的左侧显示时间?

代码js:

var displayDisponibiltyBabySitter = function(){
            var calendarEl = document.getElementById('disponiblity');
            if(calendarEl){
                var calendar = new FullCalendar.Calendar(calendarEl, {
                    defaultView: 'dayGridWeek' ,
                    validRange: function(nowDate){
                        return {start: nowDate}
                    },
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'dayGridWeek,timeGridDay'
                    },
                    locale: _mpop.current_lang,
                    timeZone: 'Europe/Paris',
                    eventBackgroundColor : "#444",
                    eventTextColor: '#EEE',
                    slotDuration: '00:60:00',
                    slotLabelFormat: [
                        {
                            hour: '2-digit',
                            minute: '2-digit',
                            hour12: false
                        }
                    ],
                    views: {
                        dayGridWeek: {
                            eventTimeFormat: {
                                hour: 'numeric',
                                minute: '2-digit',
                                omitZeroMinute: true,
                                meridiem: 'narrow'
                            }
                        }
                    },
                    events: Routing.generate('front.babysitter.disponibilities',{'id': $("#dispo-babysitter").data("id")}),
                    plugins: [ 'dayGrid', 'timeGrid', 'list' ]
                });
                calendar.render();
            }

        };

预先感谢

我有这个结果:

但是如何获得此结果:

1 个答案:

答案 0 :(得分:2)

您已将defaultView设置为“ dayGridWeek”

将其设置为:

defaultView: 'timeGridWeek'

你应该没事...