Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling the dayclick for the past dates in fullcalendar not working properly

dayClick: function(date, jsEvent, view) {
inputDate = moment(date).format('YYYY-MM-DD');
var moment2 = $('#calendar').fullCalendar('getDate');
if (date <= moment2) 
{
return false;

}

$('#datepicker2').val(inputDate);
$('#meeting').modal();

},

The above code disables dayclick the past dates and the current date too. But i need the dayclick enabled on the current date.

like image 434
Idris Avatar asked Mar 14 '23 03:03

Idris


1 Answers

Try this one.

dayClick: function( date, jsEvent, view) {
    if (moment().format('YYYY-MM-DD') === date.format('YYYY-MM-DD') || date.isAfter(moment())) {
        // This allows today and future date
    } else {
        // Else part is for past dates
    }

},

This works for me.

like image 51
Chintan Mirani Avatar answered Apr 25 '23 02:04

Chintan Mirani