5

How to show only 2 weeks or 15 days in a month view?

I tried the following:

$('#calendar').fullCalendar({
defaultView: 'month',
duration: { weeks: 2 } // or days: 15
});

but it didn't work. I read the documentation but it only shows customization of basic/agenda view.

Edit: adds picture of desire calendar

picture

Cons7an7ine
  • 708
  • 6
  • 17
  • the month view is basically static, not much you can do to customise it, unfortunately. If you _really_ need to do this, you'll have to make your own https://fullcalendar.io/docs/views/Custom_Views/ - it really is not a simple task. Or you could research and see if anyone online has made one already that you can use freely. But ask yourself if this is really completely necessary, or whether you can make do with the default month view (more data on screen at once than a 2 week view might be a good thing for users!) and/or the existing agenda views, possibly with custom time ranges. – ADyson Oct 06 '17 at 12:17
  • I did find this: https://stackoverflow.com/questions/6420200/display-2-weeks-in-jquery-fullcalendar and this: https://stackoverflow.com/questions/9708621/jquery-fullcalendar-2-week-view-next-prev-buttons but not sure if they still work in the latest fullCalendar, or if they ever worked, or whether they offer exactly what you want. But it's a starting point. – ADyson Oct 06 '17 at 12:20

1 Answers1

12

You can use week view and aside from being a bit stretched looking may give what you want

https://jsfiddle.net/x8b7a8yj/

Fiddle specs: jQuery 3.2.1, momentjs 2.18.1, fullcalendar 3.5.1

$('#calendar').fullCalendar({
    defaultView: 'week',
    views: {
        week: {
            type: 'basic', /* 'basicWeek' ?? */
            duration: { weeks: 2 }
        }
    }
});
smcd
  • 3,135
  • 2
  • 16
  • 27
  • 1
    I attached a pic of desired calendar on the question. Thanks for this, this is somewhat close. How do I make it display days by 1-15 /16-31? – Cons7an7ine Oct 09 '17 at 03:05
  • 1
    Nevermind, I got it. I feel so stupid for not noticing that adding weeks to basicWeek will make it look like a month view. – Cons7an7ine Oct 09 '17 at 07:51