Full Calendar places all events to early

别说谁变了你拦得住时间么 提交于 2019-12-13 04:59:04

问题


Well im trying to make my fullcalender work with Ajax and a database. its all working exept all my events are shown one hour early like this:

example event:

{title:'',start:'2014/11/08 02:00',end:'2014/11/08 09:30',description:'',id:'10'}

When looking at the calendar this event is displayed one hour early like this:

start:2014/11/08 01:00 end 2014/11/08 08:30

I looked at my databasetable and my source and the output is like the first one.(the start at 02:00)

My calendar is setup with the following time format(taken form the site):

  $.fullCalendar.moment('2014-05-01T12:00:00');

Why are my events one hour early?

As requested the config:

  $.fullCalendar.moment('2014-05-01T12:00:00');
    $('#calendar').fullCalendar({

        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        defaultView: 'agendaWeek',
        axisFormat: 'HH:mm',
        timeFormat: {
              agenda: 'H:mm{ - H:mm}'
         },
        firstHour: 8,
        defaultDate:Date() ,
        selectable: true,
        formatDate:"",
        selectHelper: true,
        firstDay:1,
        allDaySlot:false,
        height:600,
        editable: true,

Im using 2.1.1


回答1:


if you need to keep your current timezone settings you can add

        'timezone' : 'yourtimezone',

and at your backend for fetching events php? some other? format events like this

{ title: "event1", start: "2013-10-20T02:00:00+01:00" }
                                       ^        ^
                will always display as 2:00     |
                                                |
              the timezone offset will always be +01:00


来源:https://stackoverflow.com/questions/26736221/full-calendar-places-all-events-to-early

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!