javascript - 完整日历加载事件源,天数显示的位置不正确

标签 javascript php fullcalendar

我通过Ajax调用将数据加载到eventSource, 然后我将数据检索为.. i received as the response of Ajax call in event Source

eventSources:
        [

            // your event source
            {


                url: '/ajax-load-holidaysExtra',// use the `url` property
                type: 'POST',
                datatype: "JSON",
                data : function()
                { // a function that returns an object
                    var date =  new Date($('#calendar1').fullCalendar('getDate'));
                    month_integer = date.getMonth();
                    year_integer = date.getFullYear();
                    return {
                        month: month_integer,
                        year: year_integer
                    }
                },

                error: function() {
                    alert('there was an error while fetching eventsin hol!');
                },
                color: 'rgba(244, 221, 38, 0.20)',   // a non-ajax option
                textColor: 'blue' // a non-ajax option

            }

        ],

但是我得到的日历中显示的日期不正确,它显示的日期比我打算从 eventSource 获取的日期早 1 或 2 天。

我是完整日历的新手,请任何人帮忙......我将不胜感激

最佳答案

我找到了答案

即使数据是正确的,日历的格式也不合适......

events: [
    {
        title: 'Event1',
        start: '2011-04-04'
    },
    {
        title: 'Event2',
        start: '2011-05-05'
    }
    // etc...
],

如文档中所示,月份应为 2011-04-04 ,但在我的数据中,它是 2011-4-4 所以结果是完整的日历显示另一天。

..希望这对某人有用,所以这就是为什么我保留这个问题..如果有任何建议可供讨论...

关于javascript - 完整日历加载事件源,天数显示的位置不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41463028/

相关文章:

php - 如何显示用户信誉

jquery - 基于事件每周重复事件的完整日历

javascript - 如何在 Sharepoint 2013 中通过标题获取网站的 URL?

php - 全文搜索方法不起作用

javascript - JS Fiddle 打印/警报

php - 如果内容存在,则从多个表中选择数据,否则跳过一张表

javascript - FullCalendar Json 字符串引号属性

jquery - FullCalendar - 处理双击事件

javascript - $http ajax AngularJS POST 在 PHP 中返回 undefined index

javascript - 在 jQuery 中删除或更改 CSS 伪类