我需要在我的项目中实现时区功能。我已经在Visual Force页面上使用了完整日历。 我正在将eventsList传递为我从服务器(Apex)获取的events属性的输入。仅当我将选择列表从本地更改为UTC时,反之亦然。 但是对于任何其他时区值,它都不会更改。 如果我为完整日历提供默认的JSON,即-events属性“ https://fullcalendar.io/demo-events.json”。它适用于所有时区。
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listWeek'
},
navLinks: true, // can click day/week names to navigate views
editable: true,
selectable: true,
eventLimit: true, // allow "more" link when too many events
events: eventsList,
loading: function(bool) {
$('#loading').toggle(bool);
},
eventRender: function(event, el) {
console.log('eventRender');
// render the timezone offset below the event title
if (event.start.hasZone()) {
console.log('hasZone');
el.find('.fc-title').after(
$('<div class="tzo"/>').text(event.start.format('Z'))
);
}
},
}
});
// load the list of available timezones, build the <select> options
$.getJSON('https://fullcalendar.io/demo-timezones.json', function(timezones) {
$.each(timezones, function(i, timezone) {
if (timezone != 'UTC') { // UTC is already in the list
$('#timezone-selector').append(
$("<option/>").text(timezone).attr('value', timezone)
);
}
});
});
// when the timezone selector changes, dynamically change the calendar option
$('#timezone-selector').on('change', function() {
$('#calendar').fullCalendar('option', 'timezone', this.value || false);
});
下面是我的事件列表的结构:
[{“ id”:“ a014P00001vV9BHQA0”,“ title”:“ New Event Timezone1”,“ start”:“ 2019-09-17T04:00:00Z”,“ end”:“ 2019-09-17T05: 45:00Z“,” locTZStart“:” 09/17/2019 12:00 AM“,” locTZEnd“:” 09/17/2019 01:45 AM“,” url“:” / apex / EventForm?id = a014P00001vV9BHQA0 “,” editable“:false,” durationEditable“:true,” startEditable“:true,” className“:” null“,” isParked“:false,” isDeleted“:false,” isNew“:” false“,” presenterCount “:0,” roomBooked“:” false“,” roomName“:”“,” typeOfEvent“:”议程“}]