jQuery完整日历firstDay更改标签但不更改日期

时间:2016-09-28 11:37:10

标签: jquery fullcalendar

我在这里看到了几个关于这个问题但没有解决方案的帖子,所以我希望有人可以帮助我。

我正在开发一个实现jQuery FullCalendar但是使用Year视图作为默认值的网站。客户希望日历块以星期一而不是星期日作为默认值开始。使用firstDay设置,我将其更改为1(星期一),虽然顶部的标签发生了变化,但实际日期仍保持相同的顺序,因此它们反映了错误的日期。

以下是我的javascript代码,用于呈现日历:

$('#calendar').fullCalendar({
  theme: true,
  header: {
      left: 'prev,next today',
      center: 'title',
      right: 'year,month,agendaWeek,agendaDay'
  },
  defaultDate: '2016-01-01',
  defaultView: 'year',
  yearColumns: 3,
  firstDay: 1,
  editable: true,
  windowResize: function(view) {
      if ($(window).width() < 767){
          $('#calendar').fullCalendar( 'changeView', 'month' );
      } else {
          $('#calendar').fullCalendar( 'changeView', 'year' );
      }
  },
  eventLimit: true, // allow "more" link when too many events
  events: {
      url: '/wp-content/themes/morb/js/fullcalendar/demos/php/get-events.php',
      error: function() {
          $('#script-warning').show();
      }
  },
  loading: function(bool) {
      $('#loading').toggle(bool);
  }
});

使用标准0设置,这是本月日历的一个镜头:

enter image description here

第一天实现1,现在看起来像这样:

enter image description here

如您所见,日期保持在同一位置。

任何人都可以帮助我解决这个问题,并解释为什么会发生这种情况吗?

编辑:根据要求,我的活动json:

[{"title":"Unavailable","color":"#FF0000","start":"2016-12-30T00:00:00","end":"2017-01-02T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/31st-dec-2016\/","post_id":484},{"title":"Unavailable","color":"#FF0000","start":"2016-12-23T00:00:00","end":"2016-12-26T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/24th-dec-2016\/","post_id":482},{"title":"Unavailable","color":"#FF0000","start":"2016-12-16T00:00:00","end":"2016-12-19T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/17th-dec\/","post_id":481},{"title":"Unavailable","color":"#FF0000","start":"2016-12-02T00:00:00","end":"2016-12-05T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/3rd-dec-2016\/","post_id":480},{"title":"Unavailable","color":"#FF0000","start":"2016-12-09T00:00:00","end":"2016-12-12T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/3-dec-2016\/","post_id":479},{"title":"Booked","color":"darkgreen","start":"2016-09-23T00:00:00","end":"2016-09-26T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/24th-september\/","post_id":437},{"title":"Booked","color":"darkgreen","start":"2016-09-16T00:00:00","end":"2016-09-19T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/17th-september-2016\/","post_id":436},{"title":"Booked","color":"darkgreen","start":"2016-10-28T00:00:00","end":"2016-10-31T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/435\/","post_id":435},{"title":"Booked","color":"darkgreen","start":"2016-11-11T00:00:00","end":"2016-11-14T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/432\/","post_id":432},{"title":"Booked","color":"darkgreen","start":"2016-10-21T00:00:00","end":"2016-10-24T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/430\/","post_id":430},{"title":"Booked","color":"darkgreen","start":"2016-09-30T00:00:00","end":"2016-10-03T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/429\/","post_id":429},{"title":"Booked","color":"darkgreen","start":"2016-09-02T00:00:00","end":"2016-09-05T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/428\/","post_id":428},{"title":"Booked","color":"darkgreen","start":"2016-09-09T00:00:00","end":"2016-09-12T00:00:00","url":"http:\/\/weddingtestsite.co.uk\/booking\/427\/","post_id":427}]

0 个答案:

没有答案