"Let people pick a time" sounds like a one-day feature. We build WordPress themes at NodeThemes, and when we added appointment booking and a class schedule to our theme Avelyn (for coaches, beauty and yoga studios), the calendar was the easy part. Here is what actually took the time, in case you are building or choosing one.
Disclosure: we make Avelyn. The full, non-technical guide for business owners is on our blog: Online booking on WordPress for coaches and studios .
1. A free time is not just "not booked"
A start time is offered only when all of these are true:
it lies inside the opening hours of that weekday (with an optional second range for a lunch break),
the date is not in the closed-dates list,
it is later than now + minimum notice and earlier than today + days ahead ,
the service length plus the break after it fits before the range ends,
it does not overlap another booking, including that booking's break.
In code that is an interval check, not an equality check:
// $start / $end in Unix…