FullCalendar dayRender正在显示下一天的日期?

时间:2015-09-03 13:14:50

标签: javascript jquery timezone fullcalendar

我正在使用FullCalendar作为医生/病人预约系统。我想使用FullCalendar在患者屏幕上显示医生可用性。我正在使用dayRender函数,但它是否显示了下一天的日期,特别是EST时区。谁能让我知道我在这里失踪了什么?

dayRender: function (date, cell) {
            var view = $('#calendar').fullCalendar('getView');
            var strDay = moment(date._d).format('YYYY-MM-DD');
                $.ajax({
                    url: '/client/profile/ajaxexpertappointentclientday',
                    data: 'strDate='+strDay ,
                    type: "POST",
                    async:false,
                    success: function(intFlag) {
                        var today = moment();
                        if(intFlag == 1 && strDay >= strTodaysDate && strDay < moment(today._d).add('days', 2).format('YYYY-MM-DD')) {
                            cell.css("background-color", "red");
                        } else {
                            cell.css("background-color", "#F0F0F0");
                        }
                    }
                });
            }
        },

1 个答案:

答案 0 :(得分:1)

我不确切知道你使用的许多fullCalendar是什么。 我已经使用了这个http://fullcalendar.io/

代码示例javascript

        $('#calendar').fullCalendar(
        {
            timeFormat: {
                agenda: 'H(:mm){ - H(:mm)}',
                '': 'H(:mm){-H(:mm) }'
            },
            aspectRatio: 2,
            selectable: true,
            selectHelper: true,
            editable: false,
            theme: false,
            eventColor: '#bcdeee',
            eventSources: [
                {
                    url: '/index.php',
                    type: 'POST',
                    data:
                    {
                        controller  : "engineers",
                        action      : "getCalendar"
                    },
                    error: function()
                    {
                        alert('there was an error while fetching events!');
                    }
                }
            ],
            loading: function(bool) {
                $('#loading').toggle(bool);
            },
            eventClick: function(event)
            {
                // opens events in a popup window
                window.open("?controller=audits&action=show&id="+event.id, '_blank').focus();
                return false;
            },
        });

服务器的响应必须如下:

    [{"id":61,"title":"BOLOGNA (Bologna)","start":"2015-08-30 15:00:00+01:00","end":"2015-08-31 15:00:00+01:00","allDay":false,"color":null}]

如果在响应JSON上设置了颜色属性,则将是特定事件的颜色。

http://fullcalendar.io/docs/event_rendering/eventColor/

  

您可以使用任何CSS颜色格式,例如#f00,#ff0000,   rgb(255,0,0),或红色。