Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current displayed date range in full calendar jquery

I have implemented fullcalendar in my application. I am facing a problem for getting current displayed date range. I want to get currently displayed date range in full calendar. Please suggest me a proper solution.

For example please take a look on this image enter image description here

In this I want to get "20 Sept" and "26 Sept".

like image 800
Manoj Avatar asked Sep 25 '15 07:09

Manoj


People also ask

How do you find the date range in Fullcalendar?

You can also dynamically generate the range via a function. It must return an object in the same format: var calendar = new Calendar(calendarEl, { initialView: 'dayGridMonth', validRange: function(nowDate) { return { start: nowDate, end: nowDate.

How do I start and end date in Fullcalendar?

We can get start date by getView event with intervalStart. We can get end date by getView event with intervalEnd. var month = $('#calendar'). fullCalendar('getView').

How do I change the date on Fullcalendar?

The calendar's dates can change any time the user does the following: click the prev/next buttons, change the view, click a navlink. The dates can also change when the current-date is manipulated via the API, such as when gotoDate is called. datesSet is called after the new date range has been rendered.


1 Answers

Try this.

Add this function and call this. It will help you.

  function GetCalendarDateRange() {
        var calendar = $('#calendar').fullCalendar('getCalendar');
        var view = calendar.view;
        var start = view.start._d;
        var end = view.end._d;
        var dates = { start: start, end: end };
        return dates;
    }
like image 92
Ashok Kumawat Avatar answered Oct 10 '22 18:10

Ashok Kumawat