Fullcalendar not showing axis times for 15 min slots

只愿长相守 提交于 2019-12-04 15:44:12

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

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'
    }]
  });

});

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.

user3332306

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.

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"

are you implementing agendaWeek, agendaDay?

header: {
left: 'title',
center: '',
right: 'prev,today,next,month,agendaWeek,agendaDay'
},

Thanks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!