问题:Fullcalendar 将 24 显示为午夜而不是 00:00

Issue: Fullcalendar shows 24 as midnight instead of 00:00

出于某种原因,Fullcalendar 正在显示从午夜开始的事件,例如“24:15”。我们希望它显示“00:15”。我认为这是一个新问题,因为我们已经有了一年的日历,这是我第一次听说它。但我找不到任何关于如何解决它的信息。

我们正在使用 fullcalendar v4.2.0。原始代码不是我写的,但我对它相当熟悉。我们使用 REST API 获取事件,并且我们正在使用 ServiceNow。当使用 12 小时格式 (am/pm) 时,它显示 12a15。我尝试更改 eventTimeFormat,但没有成功。这是客户端脚本的一部分:

    /* Calendar */
c.funcs.loadCalendar = function() {
    var calendarEl = document.getElementById('calendar');
    c.calendar = new FullCalendar.Calendar(calendarEl, {
        contentHeight: 'auto',
        plugins: [ 'dayGrid','timeGrid', 'list'],
        header: {
            left: 'prev next today',
            center: 'title',
            right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek,listMonth'
        },
        buttonText: {
            dayGridMonth: 'Month',
            timeGridWeek: 'Week',
            timeGridDay: 'Day',
            listWeek: 'List Week',
            listMonth: 'List Month',
            today: 'Today'
        },
        editable: false,
        eventTimeFormat: {
            hour: '2-digit',
            minute: '2-digit',
            hour12: false
        },
        eventOverlap: false,
        firstDay: 1,
        weekNumbers: true,
        // Scripted REST API which sends Start and End date-time of current view as parameters and gets current events. 
        //events: '/api/tnas/fullcalendar_fetch_data',

        events: function(info, successCallback, failureCallback) {
            $http({
                method: 'GET',
                url: '/api/tnas/fullcalendar_fetch_data',
                headers: {
                    'X-UserToken': window.g_ck // Authorization
                },
                params: {
                    systems: c.vars.selectedSystems.map(function(system) { return system.value; }).toString(),
                    excludedTypes: c.vars.types.filter(function(type) {return !type.checked}).map(function(type) { if(!type.checked) return type.type   }).toString(),
                    start: info.start,
                    end: info.end
                }
            }).success(function(data, status) {
                successCallback(data.result.events);
            }).error(function(data, status) {failureCallback(data)});
        },
        loading: function(isLoading) {
            c.vars.calendarIsLoading = isLoading;
            $scope.$evalAsync();
        },
        // When event is rendered and put into the DOM, add a tippy.js tooltip to that element.
        eventRender: function(info) {
            tippy(info.el, {
                theme: 'light-border',
                content: info.event.extendedProps.tooltipContent,
                arrow: true,
                animation: 'fade',
                flip: false,
                boundary: 'window'
            });
        },
        eventClick: function(info){
            info.jsEvent.preventDefault();
            var p = $scope.data.page_id || 'form';
            var url = '/sp?id=' + p + '&table=' + info.event.extendedProps.table + '&sys_id=' + info.event.id + '&view=sp';
            window.open(url, "_blank");
        },
        navLinks: true,
        navLinkDayClick: function(date, jsEvent) {
            //c.calendar.gotoDate(date);
            c.calendar.changeView('timeGridDay', date);
        }
    });

    c.calendar.render();
}
/* Calendar End */

JSON 事件:

title: "Metro IN-Applikasjoner - test"
number: "SREL0004789"
start: "2020-04-15 00:15:00"
end: "2020-04-16 14:00:00"
downtime_start: ""
downtime_end: ""
className: "SystemRelease"
type: "system_release"
table: "release"
id: "4a393c2b298c54903eaa786081948e7c"
state: "New"
state_reason: null
downtime_type: "Soft"
color: "rgb(163, 222, 255, 0.5)"
tooltipContent: "<div style='text-align:left; font-size:1.5em'><p>Metro IN-Applikasjoner - test</p><p><strong>Start:</strong>   00:15, 15. apr 20</p><p><strong>End:</strong>   14:00, 16. apr 20</p></div>"

希望之前有人遇到过同样的问题。非常感谢任何帮助!

已修复:将 hour12 属性 替换为 hourCycle: 'h23' 在 eventTimeFormat 中成功了!

    eventTimeFormat: {
        hour: '2-digit',
        minute: '2-digit',
        hourCycle: 'h23'
    },