简体   繁体   English

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

[英]FullCalendar.io timeformat not working with eventsources

I'm using the calendar plugin fullcalendar . 我正在使用日历插件fullcalendar Now I want to show my date from my activities in format H(:mm)" but my code isn't working for some reason. My code is in c#. 现在,我想以H(:mm)格式显示我的活动日期”,但是由于某些原因我的代码无法正常工作。我的代码在c#中。

I've used this javascript code to get it working. 我已使用此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'
                }
            ]
        });

I've read the documentation about timeformat here . 我在这里阅读了有关timeformat的文档。 My request returns data in this format: 我的请求以以下格式返回数据:

[{"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}]

Can someone please explain to me what I'm doing wrong. 有人可以告诉我我在做什么错。 My end result of the activity has 12 as hour format and not 12:00 or 12:30 if I hardcode it. 我的活动最终结果以小时格式显示12,而不是12:00或12:30(如果我对其进行硬编码)。

timeFormat is a top level property in the fullcalendar options object. timeFormat是fullcalendar选项对象中的顶级属性。 It can't be an event property. 它不能是事件属性。

So put it here 所以放在这里

   $('#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
    });

And if you need to change on a event to event basis, you have to use eventRender . 而且,如果您需要在事件之间进行更改,则必须使用eventRender (and do it manually). (并手动执行)。

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

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