How do I restrict past and today's date from a calendar?

aszusteraszuster Chicago, ILCommunity Member Qubie ✭

How do I restrict past and today's date from a calendar?

Hi XM Community:

Is it possible to restrict today's date from showing in a calendar and only show specific dates future in the future? We are using flatpickr.js for the inline calendar.

We created a registration form for the live-training sessions that we host weekly using Research Core in Qualtrics. In the form, individuals select the training session and then proceed to pick the date and time they want to attend. We use Display Logic to determine which calendar will show depending on the training session selected because the sessions are offered on different days of the week. Currently, each calendar is set up to show today's date and specific dates when a training session is available; i.e. menu training is available on Mondays; systems training is available on Tuesdays, etc.

We pull the registrations in the morning and then email the registrants with the information to join the session. From time to time, there are individuals that register the day of the training, sometimes thirty minutes before the start of the session, so we want to restrict today's date from showing up.

Here is the code that is currently in one of the calendars; the code is identical for the others with the exception of different dates.

What do I need to add/update in the code to restrict the date for today from showing up?

Answers

  • WaterSamplerWaterSampler Community Member Guru ✭✭

    To restrict today's date, get the date for today and add one day to it. Then make that your minimum date.

  • aszusteraszuster Chicago, ILCommunity Member Qubie ✭

    The intent is to restrict the "current day" when an individual accesses the registration form; in this case, "today's date" will change every day and I prefer not to edit the form daily.

    Let me know if this makes sense; I should have posted the question differently in my original post.

  • @aszuster said:
    The intent is to restrict the "current day" when an individual accesses the registration form; in this case, "today's date" will change every day and I prefer not to edit the form daily.

    Let me know if this makes sense; I should have posted the question differently in my original post.

    You can put this at minDate - minDate : "${date://CurrentDate/DS}",

  • aszusteraszuster Chicago, ILCommunity Member Qubie ✭

    @shashi Hi Shashi:

    Thank you but this does not appear to work either. I changed the minDate as you suggested, however today's date is still visible/available in the calendar. Did I enter the code incorrectly? Is it possible to add a "+1" or other codes to make this work?

    See attached and let me know.

  • WaterSamplerWaterSampler Community Member Guru ✭✭

    var SomeDate = new Date(); // get today's date
    SomeDate.setDate(TodaysDate.getDate() + 1); // add 1 day to it
    use SomeDate as the mindate value

  • WaterSamplerWaterSampler Community Member Guru ✭✭

    oops, second line has typo. use instead:
    SomeDate.setDate(SomeDate.getDate() + 1); // add 1 day to it

Sign In to Comment