Block dates off a list if they fall between two other dates

I have a list of available times in a dropdown and I want to filter them (remove them from displaying) if they fall between two dates.

The two dates are the start and end date of database entries.

E.g. we have 10:00, 10:15, 10:30 & 10:45 available on the dropdown.

However we already have an appointment from 10:15 - 10:45.

So the dropdown will only show 10:00 and 10:45.

Let me know if you need more information!

Hey @tyler21,

So I have done something similar with an appointment booking system where they wanted to show available timeslots between a time range (eg. 10:00AM to 7PM). The problem was, is I was using this plugin that would show all timeslots in a 24 hour day and I only needed it for 8 to 9 of those hours depending on the day. I had the timeslots outputted by the plug in in a repeating group.

What I did was set a filter on the values within the RG where I am comparing 2 date values:

1. being the StartTime and EndTimes that I want
2. being the outputted dates in the RG from the plugin (Calendar Tool)

I ensured that the dates in the RG are within the StartTime and EndTimes I have saved to the DB.

What I did was, I formatted the dates to be in 24h (time only) format and then convert it to a number. Then I would take that number and ensure its within the range of the formatted Start Times and End Times (converted in the same format I just described via states). Here is a screenshot of what I did:

I hope my example, sparks a solution on your end to your problem as I believe they are similar.

Cheers!

This topic was automatically closed after 70 days. New replies are no longer allowed.