繁体   English   中英

jQuery Full Calendar事件标题时间错误

[英]jQuery Full Calendar event title time is wrong

我的UI中有一个jQuery Full Calendar,它看起来如下:

在此处输入图片说明

问题是事件标题的10:00-10:00am部分,似乎是根据设置UI元素的JSON中的事件startTime和endTime参数添加到元素中的。 请在此处查看我的代码部分:

jQuery(document).ready(function() {
        jQuery('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month, agendaWeek, agendaDay'
            },
            allDayText: 'All Day',
            columnFormat: {
                month: 'ddd',
                week: 'ddd d/M',
                day: 'dddd d/M'
            },
            editable: false,
            weekends: true,
            timeFormat: 'h:mm-h:mma ',
            axisFormat: 'hh:mma',
            firstDay: 1,
            slotMinutes: 15,
            defaultView: 'month',
            minTime: '10:00',
            maxTime: '17:00',
            monthNames: ["January","February","March","April","May","June","July", "August", "September", "October", "November", "December" ],
            monthNamesShort: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","nov","Dec"],
            dayNames: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
            dayNamesShort: ["Sun","Mon", "Tue", "Wed", "Thus", "Fri", "Sat"],
            buttonText: {
                today: "Today",
                day: "Day",
                week:"Week",
                month:"Month"
            },
            selectable: true,
            selectHelper: false,
            select: function(start, end, allDay) {

            },

            events: [
                               {
                                        id: "3",
                                        title: "My event title",
                                        start: new Date(2014,10,03,10,0),
                                        end: new Date(2014,10,03,12,0),
                                        allDay: false,
                                        backgroundColor : "#7F97FF",
                                        textColor: "white"
                                    },

问题是在UI中显示上午10:00-10:00,这没有任何意义。 根据我的活动代码,它应从10,00,00开始,至12,00,00,所以标题为何与此不匹配? 有人能帮帮我吗!

您的FullCalendar配置不正确,因为您希望每个事件都显示“开始-结束”时间。

 timeFormat: 'h:mm-h:mma ', // the output i.e. "10:00-10:00pm"
 timeFormat: 'h:mma ',      // the output i.e. "10:00pm"

 displayEventEnd : true,    // it will show on all views (Start - End) in your timeFormat

我已经更新了您的JsFiddle ,因为您忘记了插入外部源,因此我导入了FullCalendar库以进行工作。

暂无
暂无

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

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