fullcalendar - FullCalendar 中放置事件的时区

标签 fullcalendar

我正在实现 fullcalendar 并在时区问题上苦苦挣扎。

这是代码:

 $('#calendar').fullCalendar({ //re-initialize the calendar
            header: h,
            defaultView: 'agendaWeek', // change default view with available options from http://arshaw.com/fullcalendar/docs/views/Available_Views/ 
            slotMinutes: 15,
            editable: true,
            lang: 'pl',
            timezone: 'Europe/Warsaw',
            droppable: true, // this allows things to be dropped onto the calendar !!!
            drop: function(date, allDay) { // this function is called when something is dropped

                // retrieve the dropped element's stored Event Object
                var originalEventObject = $(this).data('eventObject');
                // we need to copy it, so that multiple events don't have a reference to the same object
                var copiedEventObject = $.extend({}, originalEventObject);

                // assign it the date that was reported
                copiedEventObject.start = date;
                var endDate = new Date(date);
                endDate.setMinutes(endDate.getMinutes() + 70);
                copiedEventObject.end = endDate;

                alert(date);
                alert(endDate);
                //copiedEventObject.allDay = allDay;
                copiedEventObject.className = $(this).attr("data-class");

                // render the event on the calendar
                // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
                $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

                // is the "remove after drop" checkbox checked?
                if ($('#drop-remove').is(':checked')) {
                    // if so, remove the element from the "Draggable Events" list
                    $(this).remove();
                }
            },

        });

如果我通过删除它来创建新事件,我得到的是 GMT 时区的日期时间,因为我应该设置为 CET,请帮助如何纠正删除事件时区设置。

最佳答案

我有一个类似的问题。将日历属性设置为 ** timeZone: 'none' **。否则,您需要在日期时间字符串中指定时区短代码。

关于fullcalendar - FullCalendar 中放置事件的时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27367481/

相关文章:

javascript - fullcalendar.js - 删除按钮点击事件

javascript - vue-fullcalendar - css 类和换行符不起作用

javascript - Fullcalendar 插件悬停时出现 Javascript 错误

fullcalendar - 在 Fullcalendar 中更改过去事件的颜色

javascript - 如何从 Controller 获取 FullCalendar 的事件?

jQuery FullCalendar 适用于触摸设备 - 但事件存在小问题

javascript - 发现特殊字符时 FullCalendar 停止加载

jquery - 如何在jquery fullcalendar中首先显示当前星期

javascript - 第一周的事件在 FullCalendar 中呈现接近顶部

fullcalendar - 加载日历事件的速度非常慢,有什么优化方法吗?