我试图使用FullCalendar(http://fullcalendar.io/),除了时区以外,一切都很好。出于某种原因,我不能去改变像它在网站上的例子做的时候,我看不出有什么在我的代码比这里的例子不同:FullCalendar 2.2.6时区忽略
http://fullcalendar.io/js/fullcalendar-2.2.6/demos/timezones.html
上的代码我的项目要复杂得多,所以我想尽可能地复制的例子,但它仍然不能正常工作:
<body>
<h1>Calendar:</h1>
<div class="calendar"></div>
</body>
<script>
function renderCalendar() {
$('.calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: '2014-11-12',
timezone: 'Europe\/London',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [{"title":"All Day Event","start":"2014-11-01"},{"title":"Long Event","start":"2014-11-07","end":"2014-11-10"},{"id":"999","title":"Repeating Event","start":"2014-11-09T16:00:00-05:00"},{"id":"999","title":"Repeating Event","start":"2014-11-16T16:00:00-05:00"},{"title":"Conference","start":"2014-11-11","end":"2014-11-13"},{"title":"Meeting","start":"2014-11-12T10:30:00","end":"2014-11-12T12:30:00"},{"title":"Lunch","start":"2014-11-12T12:00:00-05:00"},{"title":"Meeting","start":"2014-11-12T14:30:00-05:00"},{"title":"Happy Hour","start":"2014-11-12T17:30:00-05:00"},{"title":"Dinner","start":"2014-11-12T20:00:00+00:00"},{"title":"Birthday Party","start":"2014-11-13T07:00:00-05:00"},{"url":"http:\/\/google.com\/","title":"Click for Google","start":"2014-11-28"}],
loading: function(bool) {
$('#loading').toggle(bool);
},
eventRender: function(event, el) {
// render the timezone offset below the event title
if (event.start.hasZone()) {
el.find('.fc-title').after(
$('<div class="tzo"/>').text(event.start.format('Z'))
);
}
}
});
}
renderCalendar();
</script>
列出的事件是确切的事件从FullCalendar.io网站上的例子拉。日历呈现细,但改变时区参数不改变的情况下显示的时间:
设置时区为“无”表示+00:00事件
设置时区为“本地”显示下方-05:00时以下(EST,我的时区)
设置时区为一个特定的位置(例如,“美国/芝加哥”)显示+00:00时,无论以下指定什么地方的
这些实例中没有一个是日历上显示的事件更改的时间;如果输入的时间是14:00:00,则无论时区设置如何,都将显示为2p。有可能是我在某处丢失的明显东西,但我看不到它。任何帮助将不胜感激。谢谢。
(注意,这是FullCalendar V2所以ignoreTimezone参数不存在。)