我正在使用Arshaw fullcalendar插件版本1.5.3,
问题是我在上午9点使用本地计算机时区EST(东部时间)创建了一个事件,当我将本地计算机时区更改为IST时,该事件将在日历中的不同时间7:30 PM出现。
它对于EASTERN时区完全正常,如果更改则记录显示错误的时间。
请帮助我尝试将ignoreTimezone
初始化为false并更新版本,但似乎没有任何帮助。
// initialize the fullcalendar and set ignore timezone to false
$(document).ready(function() {
$('#calendar').fullCalendar({
events: {
url: 'http://www.google.com/your_feed_url/',
className: 'gcal-event', // an option!
currentTimezone: 'America/Chicago' // an option!
},
ignoreTimezone: false
});
});
/* Passing the event to fullcalendar to display the slots in calendar properly
It accepts the start and end time in timestamp */
event.id = appId;
event.start = startTime; // 1389358800 timestamp
event.end = endTime; // 1389359700 timestamp
event.editable = presentEvent;
event.allDay = false;
event.patient_name = patient_name;
events.push(event);
_ac.fullCalendar('addEventSource',events);
它适用于东部时区,并且插槽在上午8:00(开始时间) - 上午8:15(结束时间)正确显示
当我将本地时区更改为IST时,插槽将于下午6:30(开始时间)显示至下午6:45(结束时间)
答案 0 :(得分:1)
有时,为什么FullCalendar显示的活动时间与Google日历界面不同,可能会让人感到困惑。这涉及两个因素:
日历的时区,点击日历名称旁边的箭头后,通过“日历设置”访问
您的Google帐户的时区,可通过Google日历屏幕右上角的“设置”链接访问(靠近“退出”链接)
当两个时区相同时,你应该没有问题。当它们不同时,FullCalendar将在日历的时区中显示时间。因此,时间将与您在Google日历界面中看到的时间不同,因为它们会根据日历的GMT进行调整。解决方案是使用
currentTimezone
选项。如果将此设置为与您的Google帐户相同的时区,则所有日期应显示为一致。
由于您已向America/Chicago
时区询问Google日历,因此您返回的值将以美国中部时间(非东部)开头,然后转换为GMT作为数字时间戳。
如果您的日历实际上是IST(印度标准时间),那么您应该将时区请求为Asia/Kolkata
。
由于您使用的是数字Unix时间戳而不是解析ISO日期字符串,因此您不需要ignoreTimezone
选项(see the documentation)。它不会影响结果,所以你可以删除它。