文本自定义之timeFormat

优质
小牛编辑
125浏览
2023-12-01

设置每个事件的时间格式,值为字符串或者View Option Hash,默认值:

{
    // 日程周视图和日程天视图
    agenda: 'h:mm{ - h:mm}',  // 5:00 - 6:30

    // 其他视图
    '': 'h(:mm)t'  // 7p
}

如果使用一个格式化字符串(例如’h:mm{ – h:mm}’)将改变所有的视图,使用View Option Hash可以指定给某些视图设定时间格式(默认值就是这么做的)。

使用 formatDate/formatDates 格式规则。

只有Event Object的allday为false的才显示时间。

所有事件使用24小时制的例子:

$('#calendar').fullCalendar({
    events: [
        {
            title:  'My Event',
            start:   '2010-01-01T14:30:00',
            allDay: false
        }
        // other events here...
    ],
    timeFormat: 'H(:mm)' // uppercase H for 24-hour clock
});