Intento deshabilitar los últimos días en los que se puede hacer clic. Estoy usando dateClick pero no puedo pasar múltiples argumentos y tengo un error: *Error de tipo no detectado: date.format no es una función Mi función:
EDITAR: función Dateclick con ajax. Ahora no sé cómo deshabilitar el clic, cuando pasaron los días.
dateClick: function (info, jsEvent, view, date) { let currDate = info.dateStr; // if (moment().format('YYYY-MM-DD') === currDate || date.isAfter(moment())) { // return false; // } else { // // alert('Date: ' + currDate); // alert('ID: ' + $('#reservation-form #select-service').val()); // } let selectServiceVal = $('select#select-service').val(); if (!selectServiceVal) { alert('Najpierw wybierz usługę'); } else { dateValue.val(currDate); $.ajax({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, url: getFreeHorus + selectServiceVal + '/' + currDate, dataType: 'json', method: "POST", data: { "id": selectServiceVal, "date": currDate }, beforeSend: function () { $(".calendary-loader").css('display', 'block'); }, success: function (data) { $(".calendary-loader").css('display', 'none'); if (data.message) { alert('Wybierz poprawną datę') } displayHours(data.availableHours); }, error: function () { $(".calendary-loader").css('display', 'none'); alert('Błąd serwera, spróbuj później') } }); } }Puedes usar select . Así es como hice el mío:
select: this.handleDateClick.bind(this),
//la función handleDateClick
handleDateClick(arg: any) { let todaysDate = new Date(); let formattedDate = moment(todaysDate).format("YYYY-MM-DDTHH:mm:ss"); //formatted version of todays date so a comparison can be made let s1 = arg.startStr; let s2 = arg.endStr; let currentdate = moment().isUTC(); let newDateObj = moment(s1).add(15, "m").format("YYYY-MM-DDTHH:mm:ss"); if (s1 < formattedDate) { //This checks if time is in the past. If so, alert("This date is in the past")