最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - FullCalendar display within date range - Stack Overflow

programmeradmin4浏览0评论

I am trying to display FullCalendar withing a certain date range. To do so I added the following visibleRange option to my code but it is not working. The calendar is simply not displaying.

this.$calendar.fullCalendar({
  //other settings
            
  defaultView: 'basic',
  visibleRange: {
    start: moment('2017-05-22'),
    end: moment('2017-05-29')
  },
  duration: { days: 7 },
            
  //other settings
});

I am trying to display FullCalendar withing a certain date range. To do so I added the following visibleRange option to my code but it is not working. The calendar is simply not displaying.

this.$calendar.fullCalendar({
  //other settings
            
  defaultView: 'basic',
  visibleRange: {
    start: moment('2017-05-22'),
    end: moment('2017-05-29')
  },
  duration: { days: 7 },
            
  //other settings
});

Any idea how I can achieve this?

Thanks

Share edited May 9, 2017 at 22:31 freginold 3,9643 gold badges15 silver badges30 bronze badges asked May 8, 2017 at 22:36 lucasbokolucasboko 1391 gold badge2 silver badges9 bronze badges 2
  • 1 What version of jQuery/momentjs/fullcalendar are you using? Also, this.$calendar.fullCalendar syntax... are you using something else in the mix? Did you try invoking it as this.$calendar.fullCalendar(); and seeing if the calendar displays? Checked the console for any errors or warnings? – smcd Commented May 9, 2017 at 18:47
  • I am using fullCalendar 3.0.1 backbone.js 1.2.3 moment.js 2.9.0 this.$calendar.fullCalendar(); is for calling full calendar in backbone. Console did not show any errors in particalurAR – lucasboko Commented May 9, 2017 at 19:57
Add a ment  | 

1 Answer 1

Reset to default 3

Using momentjs 2.18.1, jquery 3.2.1, fullcalendar 3.4.0 this shows the view from 5/22 through 5/28:

  $('#calendar').fullCalendar({
    defaultView: 'basic',
    visibleRange: {
      start: moment('2017-05-22'),
      end: moment('2017-05-29')
    } // Don't use duration in bination with visibleRange? Appears to override
    /*,
    duration: {
      days: 7
    }*/
  });

Demo @ https://jsfiddle/ez33y8gv/

发布评论

评论列表(0)

  1. 暂无评论