how can i get start and end time of visible days in fullcalendar?
I need it for use in another javascript instace. Is there some function like -
$('calender').getStartTime();
?
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').
This option is available from v2. 4.0 see fullcalendar.io/docs/text/displayEventTime - You need to set it as option of fullCalendar and it affects all events. Or use CSS . fc-time{ display : none; } .
FullCalendar's getDate returns a moment object, so you need moment's toDate() method to get date out of it. So, in you code try: console. log(currentDate.
Here is an example of how to specify an array of events: var calendar = new Calendar(calendarEl, { events: [ { title : 'event1', start : '2010-01-01' }, { title : 'event2', start : '2010-01-05', end : '2010-01-07' }, { title : 'event3', start : '2010-01-09T12:30:00', allDay : false // will make the time show } ] });
If you're looking for the visible start and end date, that would be the visStart
and visEnd
property of the view object in version 1:
$('calender').fullCalendar('getView').visStart $('calender').fullCalendar('getView').visEnd
and that would be intervalStart
and intervalEnd
in version 2:
$('calender').fullCalendar('getView').intervalStart $('calender').fullCalendar('getView').intervalEnd
If you're looking for the start and end date of the current week / month, that would be the start
and end
property of the current view object:
$('calendar').fullCalendar('getView').start $('calendar').fullCalendar('getView').end
Reference : Full Calendar documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With