Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

593
Vistas
How to disable click in past days fullcalendar

I try to disable clickable past days. I'm using dateClick but can't pass multiple args and have error: *Uncaught TypeError: date.format is not a function My function:

EDIT: Dateclick function with ajax. Now don't know how to disable click, when past days

    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')
                }
            });
        }
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use select. This is how I did mine:

select: this.handleDateClick.bind(this),

//the handleDateClick funtion

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")
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda