tags:

views:

206

answers:

2

I'm using the fullcalendar jquery plugin, and would like to display 2009 and 2011 in the nextYear and prevYear buttons.

For exmaple:

2009 May 2010 2011

I know I can put static text on the buttons like this:

buttonText: { prevYear: '2009', nextYear: '2011' },

But I would like those years to change, depending on the year that the calendar is currently viewing. There's documentation about 'year' here: http://arshaw.com/fullcalendar/docs/current_date/ but I don't know how to get that 'year' property.

Any examples would be appreciated,

Thanks,

--Nate

A: 

You would probably just want to overwrite the buttons yourself and add your own events

function setYearButtons()
{
    var currentDate = $("#mycal").fullCalendar( 'getDate' );

    // I'm not 100% sure on these class names, but you can inspect the dom and figure those out
    $(".fc-button-last span").text(currentDate.getYear() + 1); 
    $(".fc-button-first span").text(currentDate.getYear() - 1);
}

Which you could call each time the year changed.

Joel Potter
A: 

been meaning to get to this. currently not possible, but made an issue in the issue tracker: http://code.google.com/p/fullcalendar/issues/detail?id=488

arshaw
of course, joel's solution looks good too
arshaw