如何设置完整日历显示下个月

How to set full calendar to show next month

我想在日历初始化时显示下个月的详细信息,

比如这个月是五月,那么下个月的六月应该显示在 日历。

这是我的代码:

$(document).ready(function() {
  var now = new Date();
  var date = new Date(now.getFullYear(), now.getMonth() + 1, 1);
  var d = date.getDate(),
    m = date.getMonth(),
    y = date.getFullYear();
  $('#calendar123').fullCalendar({
    displayEventTime: false,
    header: {
      left: 'prev,next',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    buttonText: {
      prev: "",
      next: "",
      today: 'Today',
      month: 'Month',
      week: 'Week',
      day: 'Day'
    },

    events: [{
      title: 'Team Out',
      start: new Date(y, m, d),
      backgroundColor: ('#01BC8C')
    }],
    editable: true,
    eventLimit: true,
    droppable: true
  });
});

在日历上显示下个月详细信息的最佳方式是什么?

使用默认浏览器input type date

<input id="date" type="date" value="2063-10-01">

像往常一样,在 ie 中不起作用:https://caniuse.com/#feat=input-datetime

Try this one.

 var cal = $('#calendar123');
 cal.fullCalendar({
    header: {
        left: 'title',
        center: '',
        right: 'prev,next today'
    },
    defaultDate: '2018-09-05',

    viewRender: function (view, element) {
        cur = view.intervalStart;
        d = moment(cur).add('months', 1);
    }
});`

这将自动检测当前月份,向其添加 1 个月,并将其用作初始显示的默认日期:

var cal = $('#calendar123');
cal.fullCalendar({
  header: {
    left: 'title',
    center: '',
    right: 'prev,next today'
  },
  defaultDate: moment().add(1, "months"),
});

有关工作演示,请参阅 http://jsbin.com/hulobarite/1/edit?html,js,console,output