Agregar hora de finalización para la vista semanal y diaria de FullCalendar

I am using FullCalendar v2 now and I found it is quite useful. However, I have encountered a problem when I want to show the end time of an event.

I want to show both start time and end time within a day in week and daily view like "09:00-17:00". I have found a solution in Mostrar la hora de finalización solo en la vista de semana del calendario completo but it seems a v1 version. I use this in v2 and failed.

How can I show both start time and end time within a day?

preguntado el 12 de junio de 14 a las 11:06

3 Respuestas

I found that this answer worked for me: https://stackoverflow.com/a/24951989/590382


In FullCalendar >= 2.0.1, there is a setting called displayEventEnd.

Documentación: http://fullcalendar.io/docs/text/displayEventEnd/

Whether or not to display an event's end time text when it is rendered on the calendar.

Ejemplo:

displayEventEnd: {
    month: false,
    basicWeek: true,
    "default": true
}

contestado el 23 de mayo de 17 a las 13:05

La respuesta aqui: Falta la hora de finalización del evento Fullcalendar works for version 1.6.1. However, the formatDates function has been replaced by formatRange in v2. So, use

eventAfterRender: function(event, $el, view) {
        var formattedTime = $.fullCalendar.formatRange(event.start, event.end, "HH:mm");
        // If FullCalendar has removed the title div, then add the title to the time div like FullCalendar would do
        if($el.find(".fc-event-title").length === 0) {
            $el.find(".fc-event-time").text(formattedTime + " - " + event.title);
        }
        else {
            $el.find(".fc-event-time").text(formattedTime);
        }
    }

contestado el 23 de mayo de 17 a las 13:05

Thanks! I am stuck by this replaced function and this help me! - LittPi

No need for such a convuluted answer as the one above. I had the same issue and I fixed it by simply configure the fullcalendar properties as so:

timeFormat: {
            month: "HH:mm",
            week: "HH:mm",
            day: "HH:mm"
        },

Respondido 22 Jul 14, 12:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.