FullCalendar日期&时间格式

时间:2015-02-14 07:49:05

标签: calendar fullcalendar google-calendar-api

1.在活动中开始日期:2015-02-09,结束日期:2015-02-13,

但日历视图仅限第9个日期到第12个日期

如何解决此问题?

2.我需要 dd-mm-yyyy 日期格式..我不需要时间..

如何解决这个问题?

请帮忙吗?

代码:

   $('#calendar').fullCalendar({


               header: {
                    left: 'prev,next',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                firstDay: 0,
                editable: false,
                droppable: false,

                events: [


                    {
                        title: 'Live Conference',
                        start: '2015-02-09',
                        end: '2015-02-13',
                    }, {
                        title: 'Top Secret Project',
                        start: '2015-02-14',
                        end: '2015-02-16',
                        color: '#1abc9c'
                    },

                    {
                        title: 'Free Pizza',
                        description: 'This is just a fake description for the Free Pizza.Nothing to see!',
                        start: '2015-02-14',
                        end: '2015-02-16',

                    }, {
                        title: 'Free Pizza 2',
                        description: 'This is sdfsfption for the Free Pizza.Nothing to see!',
                        start: new Date(y, m, 17),
                        end: new Date(y, m, 19),

                    }

                ],


                eventClick: function(event, jsEvent, view) {

                    $('#editevent').modal('show');
                    $('#modalTitle').val(event.title);
                    $('#modalStartDate').val(event.start);
                    $('#modalEndDate').val(event.end);
                    $('#modalBody').val(event.description);
                    //$('#eventUrl').attr('href',event.url);

                }

            });

1 个答案:

答案 0 :(得分:0)

我猜您使用的是fullcalendar 1.x.确保升级至少1.6.4 之后将timezone设置为local:

$('#calendar').fullcalendar({
    ...
    timezone: 'local',
    ...
});

请在此处查看此示例:http://jsfiddle.net/wLuj3fzv/

从fullcalendar 2.0版开始,它与momentJS集成在一起。它为日期对象的创建和操作提供了一个非常好的界面。如果您的项目可以实现,我建议使用它。

相关问题