Home / E-commerce and Business / Booking Slot Calendar

Booking Slot Calendar in JavaScript, Free with Live Demo

Free booking slot calendar in plain JavaScript. Pick a service, day and free time slot, see times in your own time zone, fill in your details and download a calendar file.

Open live demoDownload HTML fileView code on GitHub
Booking Slot Calendar JavaScript project: an appointment picker with services, available time slots and a calendar file

Runs on: Intl.DateTimeFormat and ICS files. Works in all modern browsers.

What is the Booking Slot Calendar?

A booking page with four services of different lengths, a strip of the next seven days and a grid of free times. Longer services show fewer slots.

Booked times, lunch and Sundays are unavailable, times appear in the visitor's own time zone, and after booking you can download a calendar file.

Good for

  • Salons, barbers and spas
  • Clinics and therapists
  • Tutors and coaches
  • Consultations and demos

What this project does

How it works

  1. Slots fit the serviceFor each day the script walks from opening to closing time and keeps a start time only if the whole service fits without touching a booked slot.
  2. Local times for everyoneTimes are made with Date and shown with toLocaleTimeString, so each visitor sees them in their own time zone and format.
  3. A real calendar fileThe confirmation builds an ICS file as a data link. Opening it adds the appointment to Google, Apple or Outlook calendars.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

for (let m = open; m + length <= close; m += 15) {
  const clash = booked.some(([start, len]) => m < start + len && m + length > start);
  if (!clash) slots.push(m);           // minutes after midnight
}
const ics = `BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\n` +
  `DTSTART:${utc(start)}\r\nDTEND:${utc(end)}\r\nSUMMARY:Haircut\r\n` +
  `END:VEVENT\r\nEND:VCALENDAR`;
link.href = "data:text/calendar," + encodeURIComponent(ics);

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

Where do booked times come from?

In the demo they are made up. In a real site, fetch booked slots for the chosen day from your server.

How do I stop double bookings?

Check the slot again on the server when the booking is saved, and refuse it if someone else took it a moment earlier.

Does the ICS file work with Google Calendar?

Yes. Opening the file on a phone or computer offers to add it to the default calendar app.

More E-commerce and Business projects