kheya
kheya

Reputation: 7612

How to get start and end date from jQueryFullcalendar?

I need to know the start and end date in monthly and weekly view.

Is there a way to do this easily with the plugin?

Another question: Is it possible to implement client side caching for this plugin so that it caches 12 months of events.

This way, when user goes back, I don'e have to go to the server to pull that data.

Thanks

Upvotes: 1

Views: 3853

Answers (2)

Harsha Kasturi
Harsha Kasturi

Reputation: 243

My answer was based on FullCalendar v2.3.2

var viewStartDate = getViewFormattedDate($('#calendar').fullCalendar('getView').start._d);
var viewEndDate = getViewFormattedDate($('#calendar').fullCalendar('getView').end._d);
console.log(viewStartDate+"---"+viewEndDate);

You will get the Date object, and you can convert it into which ever date format you want to.

Upvotes: 1

Lukasz Koziara
Lukasz Koziara

Reputation: 4320

View Object has start, end, visStart and visEnd properties, so you can simply try:

viewDisplay: function(view) {
    alert('Visible start date ' + view.visStart);
}

Of course you can get whole View Object using jQuery:

$('#id_of_calendar_div').fullcalendar('getView')

or only specific property:

$('#id_of_calendar_div').fullcalendar('getView').visStart

Upvotes: 1

Related Questions