简体   繁体   中英

Custom titleFormat for week view in fullCalendar

I'm trying to upgrading fullCalendar from 1.6 to 3.0

Previously my titleFormat was :

titleFormat: {
    month: "MMMM yyyy",
    week: "'Week from 'd [MMMM] { 'to' d MMMM  yyyy}",
    day: "dddd d MMMM yyyy"
},

Now I use the view specific options as describe in the titleFormat documentation :

    views: {
        month: {
            titleFormat: "MMMM YYYY",                  
        },
        week: {
            columnFormat: "dddd d",            
        },
        day: {
            titleFormat: "dddd d MMMM YYYY",
            columnFormat: "dddd d",           
        }
    },

But I can't reproduce the same text for the week. Indeed, according to the formatRange documentation:

FullCalendar will intelligently use it to format both dates with a dash in between.

Am I missing something ?

I got the answer on github

possible with the momentjs literal text formatting (with the [ ] commands) as well as the undocumented titleRangeSeparator setting:

 views: { week: { titleFormat: '[Week from] D MMMM YYYY', titleRangeSeparator: ' to ', } }, 

http://jsbin.com/nuruxizuli/1/edit?js,output

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM