[英]Full calendar: On click of time slot wrong time selected
终于我得到了解决方案。
dayClick: function(date, allDay, jsEvent, view)
{
alert(date); // Gives Sat Nov 21 2015 19:00:00 GMT+0000
}
这个日期给了我星期六2015年11月21日,格林尼治标准时间+0000。 我的时区是亚洲/加尔各答(GMT + 05:30)。 因此它将自动将05:30小时添加到19:00:00。 因此日期将转换为第二天。
对于这个问题,我做下面的过程。
dayClick: function(date, allDay, jsEvent, view)
{
var tzDifference = date.getTimezoneOffset() //this gives me timezone difference of local and UTC time in minutes
var offsetTime = new Date(date.getTime() + tzDifference * 60 * 1000); //this will calculate time in point of view local time and set date
}
而且我得到了想要的日期。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.