我有一堆日历都来自网站上的Google日历,除了以24h格式显示的事件外,其他所有功能都很好。
我试图在jQuery代码中进行设置,但是我找不到正确的代码来实现。在Google日历设置中,它们都设置为12H,因此必须在fullCalendar
中设置。
这是我进行搜索时可以找到的唯一代码,它似乎没有做任何事情:
$(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
timeFormat: 'h(:mm)t',
timezone: 'America/Toronto',
googleCalendarApiKey: 'hidden',
eventSources: [{
googleCalendarId: 'hidden',
className: 'calendar'
}]
});
});
timeFormat
是控制它的正确行吗?
谢谢!
答案 0 :(得分:0)
timeFormat
选项是正确的设置。
现在,您需要consult the momentJS documentation(与此fullCalendar documentation链接(又与timeFormat documentation链接))知道可以使用哪种格式的字符串来显示时间以您想要的格式。
例如:
timeFormat: "HH:mm"
将为您提供24小时的服务时间,例如21:00
等。如果需要显示一些稍有不同的内容,可以自行修改。