What is alternative solution for below piece of code if I wanted to write use this in React js or simple Javascript ? var startDate = $('#calendar').fullCalendar('getView').intervalStart.format('DD/MM/YYYY'); var endDate = $('#calendar').fullCalendar('getView').intervalEnd.format('DD/MM/YYYY');
fullcalendar get current month start and end date react example
4.3k Views Asked by KAJAL NANAWARE At
3
There are 3 best solutions below
0
On
Hope its working
<FullCalendar
datesSet={(arg) => {
console.log(arg.start) //starting visible date
console.log(arg.end) //ending visible date
}}
/>
0
On
Get current month where January = 1, December = 12
const getCurrentMonth = (arg) => {
const startDate = arg.view.activeStart
if (arg.view.type === 'dayGridMonth'){
console.log('Current Month', startDate.getMonth() + 1 )
return
}
if( arg.view.type === 'dayGridDay'){
startDate.setDate(startDate.getDate() + 8)
console.log('Current Month', startDate.getMonth() + 1 )
}
}
<FullCalendar
datesRender={(arg) => getCurrentMonth(arg)}
/>
you can use
datesRenderprops to get the active month range.