24 hour time format (so no AM to PM) for fullCalendar

后端 未结 13 1305
日久生厌
日久生厌 2020-12-25 12:09

I\'m trying to display the 24 hour time format in fullCalendar, I\'m trying to use these instructions: http://arshaw.com/fullcalendar/docs/text/timeFormat/

So I\'ve

13条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-25 12:43

    in v4, you can set the calendar option programmatically to achieve the 24h format for the hour label on the left of the grid:

    const slotLabelOption = {
        hour: 'numeric',
        minute: '2-digit',
        omitZeroMinute: false,
        meridiem: 'narrow',
        hour12: false
    };
    calendar.setOption('slotLabelFormat', slotLabelOption);
    

    For the event time do the same:

     const eventTimeOption = {
            hour: 'numeric',
            minute: '2-digit',
            omitZeroMinute: false,
            meridiem: 'narrow',
            hour12: false
        };
     calendar.setOption('eventTimeFormat', eventTimeOption);
    

    with calendar = new FullCalendar.Calendar(....) //however you initialize it

提交回复
热议问题