【问题标题】:Timezone for dropped event in FullCalendarFullCalendar 中删除事件的时区
【发布时间】:2014-12-08 21:40:35
【问题描述】:

我正在实施全日历并努力解决时区问题。

代码如下:

 $('#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,请帮助如何纠正删除事件时区设置。

【问题讨论】:

  • 你有没有想过解决这个问题?

标签: fullcalendar


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-08
    • 2014-02-18
    • 1970-01-01
    • 1970-01-01
    • 2020-01-13
    • 1970-01-01
    相关资源
    最近更新 更多