question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to hide day numbers/events/cells for prev/next months

See original GitHub issue

Originally reported on Google Code with ID 166

For example, October 2009 starts on a Thursday so you also see September 27
thru 30 at the beginning of the calendar. Is there any way to turn this off
so those cells would simply be blank?

Reported by snh9905 on 2009-11-04 17:33:55

Imported with 20 stars.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:26 (20 by maintainers)

github_iconTop GitHub Comments

6reactions
arshawcommented, Mar 23, 2017

Released in v3.3.0 Blog post: https://fullcalendar.io/blog/2017/03/fullcalendar-33-and-scheduler-16/

Setting: https://fullcalendar.io/docs/display/showNonCurrentDates/ (set it to false)

The styling is a bit different that I originally depicted. Hope that’s okay. Still stylable via CSS.

3reactions
tamtam22commented, Jul 11, 2016

For those who are looking for a temporary fix (for v2), here’s the solution:

First of all, we need to ensure that only events for this month are being rendered

    eventRender: function(event, element, view) {
        // ignored for day view since it only sees 1 date (no overlap across days of different months)
        // ignored for week view since we want to see events which appears in 2 different months (overlap)
        // this will only be triggered in initialization or when view is changed to month view to hide events from other months
        if(view.name == "month") {
            if(event.start._i.split("-")[1] != getMonthFromString(view.title.split(" ")[0])) {
                return false;
            }
        }
    }

You will need this method in javascript as well to extract the month which is used in eventRender method above:

    function getMonthFromString(mon){
        var d = Date.parse(mon + "1, 2012");
        if(!isNaN(d))
            return new Date(d).getMonth() + 1;
        return -1;
    }

Next we need to ensure that this is not the same case for Week view since it can be an overlap across 2 different months

    viewRender: function(view, element) {
        if(view.name == "agendaWeek" || view.name == "basicWeek")
            $('#calendar').fullCalendar('rerenderEvents');
    }

With the above 2 functions in place, you will achieve the result!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found