How to schedule time slots and check availability?

7 min read
Tags:

Building a scheduling application that displays the organizer’s available timeslots seems like a simple problem at first glance, but it can easily become very hard to manage when accounting for the numerous possible edge cases that exist. The timeslot calculation is the core of any scheduling application. As such it must be robust enough to allow building extra features and functionality on top of, while also being flexible enough to handle as many of your customer’s use cases as possible. This blog will go into details on how Nylas solved these challenges in our v3 Scheduler.

What is time slot scheduling? 

Time slot scheduling is a method used to divide a day into predefined periods, allowing organizers to book and manage meetings or appointments. Each slot represents a window of availability, such as 30 minutes or an hour. These slots are automatically marked as “free” or “busy” based on the organizer’s calendar. Whether scheduling a doctor’s appointment, a business meeting, or a consultation, creating and managing time slots streamlines the process.

Challenges arise when trying to calculate how each timeslot should be created:

  • When should the first timeslot of each day be displayed? Organizers have different business hours and these need to be accounted for.
  • How often should a timeslot be created? Displaying more timeslots means more options for when the meeting can occur, but some organizers might not want to book meetings at odd times (20 minutes past the hour, for example).
  • Should timeslots only start at certain times (on the hour, for example)? This can significantly impact the number of free timeslots, as we no longer consider any other potential starting time.
  • How can meetings with odd durations be handled gracefully? Booking a meeting with 45 minute duration can create odd-looking timeslots if we generate them sequentially.

The challenge in building an application like this is not only accounting for these cases, but also ensuring that your users understand how these settings impact their scheduling pages. Time is an intrinsically difficult concept to put into writing, so creating an interface that allows users to easily grasp these concepts is not straightforward. The UI or API that they interact with must be simple enough for them to understand at a glance, but also flexible enough to allow them to tweak these settings to match their specific use-cases.

Why Effective Time Slot Scheduling Matters

Managing time slots effectively helps prevent scheduling conflicts, eliminates double bookings, and saves time by avoiding back-and-forth communication. It also allows customers or colleagues to book a time that suits them, improving their experience and your efficiency.

For businesses using scheduling apps or services like the Nylas Scheduler, customization is key. Features such as time slot intervals, meeting duration, and rounding provide full control, allowing you to personalize your schedule and improve time management.

How to Schedule Time Slots and Check Availability

Scheduling time slots with tools like Nylas involves calculating available times based on the organizer’s calendar. While it may seem simple, factors such as variable meeting durations, different working hours, and overlapping events add complexity. The Nylas Scheduler offers a flexible solution by allowing organizers to set custom parameters like meeting duration and time slot intervals.

The Nylas calendar availability API (Nylas v3 Email, Calendar, and Contacts API docs ) is able to handle all of these cases through three key settings; duration_minutes, interval_minutes, and round_to. Let’s talk about what these settings do, and the use-cases they solve.

For example, to schedule 60-minute meetings, available slots will only show up where a full 60 minutes is free. Here’s how to configure time slots:

Meeting Duration

This is arguably the simplest setting to understand. The duration_minutes defines the duration (in minutes) of the event that is being booked. When calculating the available timeslots, we will only return timeslots that can fit the entire duration of the meeting. This is the only setting of the three that is required by our API since it drives the entire availability calculation.

In this example, we want to calculate the available timeslots for a meeting from 9 a.m. to 5 p.m. on a day when the organizer is busy from 11:30 a.m. to 1:30 p.m. and 2:00 p.m. to 3:30 p.m.

If we set the meeting duration to 60 minutes, we will only return the timeslots where a 60 minute meeting could fit. In this case only three timeslots will be returned:

  • 9:00am – 10:00am,
  • 10:00am – 11:00am
  • 3:30pm – 4:30pm.

Timeslot Intervals

What if we have a scenario where the organizer wants to try to provide more timeslot options for booking? For example, a timeslot every 30 minutes for an event that is 60 minutes in duration. This could potentially offer more options, but isn’t something that can be solved by adjusting the meeting duration. This is what the interval_minutes setting can configure. This setting in the Nylas API is optional, and will default to the value of duration_minutes if not set.

If we take the scenario from the previous section, we can see that a 30 minute interval creates significantly more timeslots for a meeting with a 60 minute duration.

With this interval, we return the following timeslots:

  • 9:00am – 10:00am
  • 9:30am – 10:30am
  • 10:00am – 11:00am
  • 10:30am – 11:30am
  • 3:30pm – 4:30pm
  • 4:00pm – 5:00pm

With this setting is it also possible to create intervals that are longer than the duration of the meeting. Remember that timeslots are only generated at the beginnings of intervals. This means that even if there is a time period that could fit the 60 minute duration, it will only be considered if it matches the start of an interval. We can see that if we set the interval to 90 minutes, there are significantly less timeslots generated:

  • 9:00am – 10:00am
  • 10:30am – 11:30am

Rounding

Although the combination of meeting duration and timeslot intervals provide organizers the option to customize when and how often timeslots are generated, there are still some scenarios that can’t be handled with just these two properties.

If an organizer only wants timeslots to be generated at the top of each hour, this can’t be solved without adding further customization. Similarly, there is an edge case where a meeting may end at a strange time (eg. 10:18am). In these cases depending on the timeslot interval settings, we may generate timeslots at odd times for the rest of the day (10:18am – 10:48am, 10:48am – 11:18am, etc).

This is why we introduce the round_to property in our API. This optional property allows organizers to define how timeslots should be rounded. Nylas allows rounding timeslots in intervals of 5min up to 60min (default 15min).

If we apply a rounding of 60 minutes to the previous example, we can see that there is now only a single valid timeslot. The 90 minutes intervals will be rounded up to the nearest hour, which will lead to some inconsistent gaps between timeslots. For this reason, we don’t recommend rounding timeslots to a value that is not a divisor of the timeslot interval.

  • 9:00am – 10:00am

Open Screenshot 2024-10-22 at 1.21.12 PM.png

Let’s see what this would look like with a more common use-case. In this example, we set the meeting duration to 30 minutes, the timeslot interval to 60 minutes, and the rounding value to 60 minutes. We will generate timeslots only on the hour, instead of immediately following a meeting, so the available timeslots will be:

  • 9:00am – 9:30am
  • 10:00am – 10:30am
  • 11:00am – 11:30am
  • 4:00pm – 4:30pm

The Nylas Scheduler provides these options to simplify time management for both organizers and attendees, ensuring availability and reducing the chance of conflicts.

Wrapping up

The examples we covered here are a good starting point into the many use-cases that scheduling applications can potentially solve. The problems that need to be solved extend past the generation of timeslots, but with the settings described in this blog it should be straightforward to build more complex features on top.

The Nylas Scheduler exposes these settings so that organizers can create scheduling pages that match their specific use-cases without compromising ease of use. You can read more about all of the features offered in our Scheduler Documentation.

Related resources

Nylas Virtual Calendars: Book Anything, Anytime, Anywhere

Schedule calendar events for people, places, and things without creating and managing a third party calendar account.

Nylas Beats Kloudless on Security, Performance, Feature Depth & Pricing

Kloudless doesn’t accurately portray the capabilities of their product, so why would you trust them for your next integration?

Now Available: Service Accounts for Calendar Authentication

Onboard enterprise organizations instantly with service accounts for calendar.