I am trying to find a way to remove the colon from the times in full calendar. For example I want to time to display like 1400 and not 14:00.
The code I have used so far work for converting to 24 hour time with a leading zero but I can find a way to get rid of the colon.
slotLabelFormat: {
hour: '2-digit',
minute: '2-digit',
hour12: false
},
Not sure that FullCalendar has native support for this, but it supports adding datetime library plugins. If you add moment.js as a plugin you can set up your calendar with a formatting string, something like this:
import momentPlugin from '@fullcalendar/moment';
const calendar = new Calendar(calendarEl, {
plugins: [momentPlugin],
slotLabelFormat: 'HHmm'
});
The 'HHmm' formatting string will give you a padded 24-hour hour and a padded minute, and as there is no colon between them, you have your military time. Take a look at their docs for using momentjs plugin as well as Moment's own docs on formatting strings .
If you prefer a different plugin, they have another option (Luxon) listed here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.