Mukeysh
Mukeysh

Reputation: 189

How can i change the date format for "list-month view" in full calendar?

I just want to change the date format for list month view('fc-list-heading-main') in full calendar. I tried all different way but i was not successful. Please let me know how can i change date format.

Any help would be appreciated.

Upvotes: 2

Views: 3840

Answers (2)

Adam
Adam

Reputation: 76

After going through the source code (fullcalendar.js) I have found the solution: there is an option called listDayFormat. So try something like:

$('#calendar').fullCalendar({
    defaultView: 'listMonth',
    listDayFormat: 'D MMMM YYYY'
});

This will change the date format for fc-list-heading-main. There is also an alternative formatting option called listDayAltFormat, that one is responsible for the formatting inside fc-list-heading-alt.

Upvotes: 5

Mukeysh
Mukeysh

Reputation: 189

Right now i didn't find any solution for this. I didn't find any full calendar api for this. I have fixed this with jQuery.

jQuery('.fc-list-table .fc-list-heading').each(function () {
       jQuery(this).find(".fc-list-heading-main").html(jQuery(this).find(".fc-list-heading-main").text().split(',')[0].split(' ')[1]);
     });
     jQuery('.fc-list-table .fc-list-heading').each(function () {
       jQuery(this).find(".fc-list-heading-alt").html(jQuery(this).find(".fc-list-heading-alt").text().slice(0, 3));
     });

Placed the above code after calendar rendered. Also added this code for next and previous events.

Upvotes: 0

Related Questions