繁体   English   中英

FullCalendar.io时间格式不适用于事件源

[英]FullCalendar.io timeformat not working with eventsources

我正在使用日历插件fullcalendar 现在,我想以H(:mm)格式显示我的活动日期”,但是由于某些原因我的代码无法正常工作。我的代码在c#中。

我已使用此javascript代码使其正常运行。

       $('#calendar').fullCalendar({
            header: {
                left: 'prev,title,next',
                right: 'today,basicDay,basicWeek,month'
            },
            lang: 'nl',
            defaultDate: new Date(),
            eventLimit: true, // allow "more" link when too many events
            fixedWeekCount :false, 
            eventSources: [                    
                {   
                    url: '/Groups/GetActivities',
                    type: 'GET',
                    data: {
                            startdate: "2014-12-01",
                            enddate: "2014-12-31",
                            groupid: @Model.Group.Id,
                    },
                    allDay:false,
                    timeFormat:"h:mm",
                    color: '#EAE9E0'
                }
            ]
        });

我在这里阅读了有关timeformat的文档。 我的请求以以下格式返回数据:

[{"title":"Bergmonicursus - Val d\u0027anniviers","start":"2015-01-03T12:00:00","end":"2015-02-03T08:00:00","url":"/activities/95/detail?groupid=156","allDay":false}]

有人可以告诉我我在做什么错。 我的活动最终结果以小时格式显示12,而不是12:00或12:30(如果我对其进行硬编码)。

timeFormat是fullcalendar选项对象中的顶级属性。 它不能是事件属性。

所以放在这里

   $('#calendar').fullCalendar({
        header: {
            left: 'prev,title,next',
            right: 'today,basicDay,basicWeek,month'
        },
        lang: 'nl',
        defaultDate: new Date(),
        eventLimit: true, // allow "more" link when too many events
        fixedWeekCount :false, 
        eventSources: [                    
            {   
                url: '/Groups/GetActivities',
                type: 'GET',
                data: {
                        startdate: "2014-12-01",
                        enddate: "2014-12-31",
                        groupid: @Model.Group.Id,
                },
                allDay:false,
                //timeFormat:"h:mm", // X--- Not here
                color: '#EAE9E0'
            }
        ],
        timeFormat:"h:mm", // <---- Here
    });

而且,如果您需要在事件之间进行更改,则必须使用eventRender (并手动执行)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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