繁体   English   中英

全日历:在点击时隙时选择了错误的时间

[英]Full calendar: On click of time slot wrong time selected

在此处输入图片说明 我在项目中使用了全压光机。 DefaultView是周视图。

在周视图中,当在下午5点至下午6点(日期:21-11-2015)之间单击时,它提供了21-11-2015 5:00 pm至6:00 pm的完美时间段,但是当我单击7pm至8pm(日期:2015年11月21日)的时间段给了我错误的时间,时间为22-11-2015 7:00 pm至8:00 pm。

我不知道日期怎么改到第二天。 实际日期必须为2015年11月21日晚上7:00至晚上8:00。

我的时区是亚洲/加尔各答(GMT + 05:30)。

终于我得到了解决方案。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM