我尝试以fullCalendar显示24小时制,我尝试使用以下说明:http://arshaw.com/fullcalendar/docs/text/timeFormat/

所以我加了

timeFormat: {
    agenda: 'H(:mm)' //h:mm{ - h:mm}'
},

到json.php:

$(document).ready(function() {
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        editable: true,
        allDayDefault: false,
        events: "core/displays/calendar/json-events.php",
        defaultView: 'agendaDay',
        timeFormat: {
            agenda: 'H(:mm)' //h:mm{ - h:mm}'
        },
        eventDrop: function(event, delta) {
            alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)');
        },
        eventClick: function(calEvent, jsEvent, view) {
            window.location = "details_view.php?id=" + calEvent.id;
        },
        loading: function(bool) {
            if (bool)
                $('#loading').show();
            else
                $('#loading').hide();
        }
    });
});

但这没有用,所以我已经添加到fullCalendar.js

// time formats
titleFormat: {
    month: 'MMMM yyyy',
    week: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}",
    day: 'dddd, MMM d, yyyy'
},
columnFormat: {
    month: 'ddd',
    week: 'ddd M/d',
    day: 'dddd M/d'
},
axisFormat: 'H(:mm)', //,'h(:mm)tt',
timeFormat: {
    agenda: 'H(:mm)' //h:mm{ - h:mm}'
},
// locale

但这也不起作用,我在做什么错?

最佳答案

您想要将布局设置为24小时制或事件。

如果要添加到事件中,请像22:00'party'那样放置,然后将timeFormat:'H:mm'添加到json.php文件中。

eventDrop: function (event, delta) {
        alert(event.title + ' was moved ' + delta + ' days\n' +
            '(should probably update your database)');
},
timeFormat: 'H:mm',

如果要更改日历的布局,请转到fullCalendar.js

抬头:

setDefaults

并如下更改代码。
setDefaults({
    allDaySlot: true,
    allDayText: 'Volledige dag',
    firstHour: 8,
    slotMinutes: 30,
    defaultEventMinutes: 120,
    axisFormat: 'HH:mm',
    timeFormat: {
        agenda: 'H:mm{ - h:mm}'
    },
    dragOpacity: {
        agenda: .5
    },
    minTime: 0,
    maxTime: 24
});

07-24 09:50
查看更多