jquery – fullCalendar的24小时时间格式(所以没有AM到PM)

我试图在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’的事件,然后添加时间格式:’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

});

它适用于我,

翻译自:https://stackoverflow.com/questions/9080944/24-hour-time-format-so-no-am-to-pm-for-fullcalendar

转载注明原文:jquery – fullCalendar的24小时时间格式(所以没有AM到PM)