Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making fullcalendar scroll to the current time?

Simply put, is there a way to have fullcalendar scroll to the current time position in the week view?

If it helps, I'm using Ruby on Rails and jQuery

like image 731
amr Avatar asked Jul 23 '10 12:07

amr


People also ask

How do I get the current date in FullCalendar?

Calendar::getDate Returns a Date for the current date of the calendar. For month view, it will always be some time between the first and last day of the month.

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').

Is FullCalendar open source?

With over 10 years of open source and over 120 contributors, FullCalendar will always have a free and open source core.


1 Answers

This is what I used to scroll to the current time in the view :

var scrollTime = moment().format("HH:mm:ss");
$('#calendar').fullCalendar({
    now: today,
    scrollTime: scrollTime
});

For UX purpose, I rounded down to the nearest hour so user can clearly see where (when) the calendar view is :

var scrollTime = moment().format("HH") + ":00:00";
$('#calendar').fullCalendar({
    now: today,
    scrollTime: scrollTime
});

Check the fullCalendar scrollTime parameter.

like image 163
Gabriel Glenn Avatar answered Oct 23 '22 01:10

Gabriel Glenn