Javascript 周视图的新版本中的完整日历标题范围错误

Javascript 周视图的新版本中的完整日历标题范围错误,javascript,fullcalendar,title,Javascript,Fullcalendar,Title,我正在为我的项目使用最新版本的完整日历。3.1.0 我注意到,我在这里试图完成的工作实际上曾经奏效,但后来在版本2中被破坏了。。某种程度的。 请看这些小提琴作比较 旧版本: 新版本: 上面的两个小提琴都使用这种类型的代码设置标题: $('#calendar').fullCalendar({ defaultView: 'basicWeek', header: { left: 'prev,next today', center: 'title',

我正在为我的项目使用最新版本的完整日历。3.1.0 我注意到,我在这里试图完成的工作实际上曾经奏效,但后来在版本2中被破坏了。。某种程度的。 请看这些小提琴作比较

旧版本:

新版本:

上面的两个小提琴都使用这种类型的代码设置标题:

$('#calendar').fullCalendar({
    defaultView: 'basicWeek',
    header: {
        left: 'prev,next today',
        center: 'title',
        right: ''
    },       
    editable: true,
    weekends:false,
请注意,在工作表中,标题按日期正确调整,其中没有工作表仍然列出周六和周日范围 你能告诉我这些变化是什么,为什么会坏掉吗? 我想他们正在进行修复,但我现在能做些什么来修复代码吗?

试试这个:

$('#calendar').fullCalendar({
  defaultDate: moment(),
  header: {
    left: 'prev,next today',
    center: 'title',
    right: ''
  },
  defaultView: 'basicWeek',
  weekends: false,
  eventAfterAllRender: function(view) {
    var firstDate = moment($('th.fc-day-header:first').data("date"));
    var lastDate = moment($('th.fc-day-header:last').data("date"));
    if (firstDate.month() == lastDate.month()) {
      $('.fc-center').find('h2').html(firstDate.format('MMM') + ' ' + firstDate.format('D') + ' - ' + lastDate.format('D') + ', ' + firstDate.format('YYYY'));
    } else {
    //logic to show title for dates with different months / years
      $('.fc-center').find('h2').html('');
    }
  }
});

谢谢你,我更新了你的小提琴以满足我的需要。我需要标题在下一个和上一个按钮之间,看起来像2017年9月1日-2017年13月1日的格式。。不过我确实注意到了一个问题。如果您导航到有月变的周,那么如果同一周有1/31和2/1等,它不会显示buttonsHi@coder之间的标题。如果开始日期和结束日期在不同的月/年,您必须自行实施。我只给了你一些工作;)实际上需要3种格式:2017年12月24日至30日,或2017年4月30日至5月6日,或2017年12月31日至2018年1月6日。没问题,我已经按照我需要的方式完成了。那太好了。我很好奇,想知道你是否知道我上一篇帖子的答案:如果你好奇,这是你描述的bug的官方标签: