开发者

Changing the format of the day title in weekview

开发者 https://www.devze.com 2023-03-23 23:39 出处:网络
How can I change the formatting of the date in Fullcalendar -> weekview. It now says: Sun 7/24M开发者_如何学运维on 7/25Tue 7/26Wed 7/27 Thu 7/28 Fri 7/29Sat 7/30

How can I change the formatting of the date in Fullcalendar -> weekview.

It now says:

Sun 7/24  M开发者_如何学运维on 7/25  Tue 7/26  Wed 7/27 Thu 7/28 Fri 7/29  Sat 7/30

I want to switch month and day around so it says

Sun 24/7  Mon 25/7  Tue 26/7 Wed 27/7 Thu 28/7 Fri 29/7  Sat 30/7  

which is the way our users are used to in the country where I live/work.


I have found a solution:

columnFormat: {
    month: 'ddd',
    week: 'ddd d/M',
    day: 'dddd d/M'
},


You can use this undocumented config variable to make a general change for all appearances of date/month so you don't have to specify it per view:

dayOfMonthFormat: 'ddd DD/MM',


There is a mistake, the first character must be lowercase:

columnFormat: { month: 'ddd', week: 'ddd d/M', day: 'dddd d/M' },


try this then..

$('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,basicWeek,basicDay'
            },
            defaultView: 'basicWeek',
            editable: true,
            events: [
                {
                    title: 'All Day Event',
                    start: new Date(y, m, 1) // change the format here.
                },
                {
                    title: 'Long Event',
                    start: new Date(y, m, d-5),
                    end: new Date(y, m, d-2)
                }


You can do this easily with this setting:

'ddd'     // like 'Mon', for month view
'ddd M/D' // like 'Mon 9/7', for week views
'dddd'    // like 'Monday', for day views

Example Fullcalendar

$('#calendar').fullCalendar({ columnFormat: "ddd D/M" });

OR

$('#calendar').fullCalendar({ columnHeaderFormat: "ddd D/M" });

For more details Click here!

0

精彩评论

暂无评论...
验证码 换一张
取 消