Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

586
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!