Availability Calendar for Website Booking

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1215
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1043
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Booking Availability Calendar Implementation

Availability calendar is the central UI element of booking system. Shows which dates are open for booking, which are occupied, which are blocked. Correct display determines user experience and number of erroneous bookings.

Availability Logic

Slot availability determined by intersection of multiple sources:

interface AvailabilitySlot {
  datetime:  Date;
  available: boolean;
  reason?:   'booked' | 'blocked' | 'outside_hours' | 'capacity_full';
  capacity?: number;    // for group booking
  remaining?: number;
}

class AvailabilityService {
  async getAvailability(resourceId: number, from: Date, to: Date): Promise<AvailabilitySlot[]> {
    const [schedule, bookings, blocks] = await Promise.all([
      this.getWorkingSchedule(resourceId),  // working hours
      this.getBookings(resourceId, from, to),
      this.getBlocks(resourceId, from, to), // manual blocks
    ]);

    return this.generateSlots(from, to, schedule, bookings, blocks);
  }
}

Calendar Component (React)

import { useState } from 'react';
import { useQuery } from '@tanstack/react-query';
import { startOfMonth, endOfMonth, eachDayOfInterval, format, isSameDay } from 'date-fns';
import { enUS } from 'date-fns/locale';

interface DayAvailability {
  date:      string;
  hasSlots:  boolean;
  allBooked: boolean;
}

export function AvailabilityCalendar({ resourceId, onDateSelect }: Props) {
  const [currentMonth, setCurrentMonth] = useState(new Date());

  const { data: availability } = useQuery({
    queryKey: ['availability', resourceId, format(currentMonth, 'yyyy-MM')],
    queryFn:  () => fetchMonthAvailability(resourceId, currentMonth),
    staleTime: 60_000,
  });

  const days = eachDayOfInterval({
    start: startOfMonth(currentMonth),
    end:   endOfMonth(currentMonth),
  });

  return (
    <div className="grid grid-cols-7 gap-1">
      {/* Day of week headers */}
      {['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(d => (
        <div key={d} className="text-center text-xs text-gray-500 py-2">{d}</div>
      ))}

      {/* Days of month */}
      {days.map(day => {
        const dateStr  = format(day, 'yyyy-MM-dd');
        const dayData  = availability?.find(a => a.date === dateStr);
        const isToday  = isSameDay(day, new Date());

        return (
          <button
            key={dateStr}
            disabled={!dayData?.hasSlots || dayData?.allBooked}
            onClick={() => onDateSelect(day)}
            className={cn(
              'aspect-square rounded-lg text-sm font-medium transition-colors',
              isToday && 'ring-2 ring-blue-500',
              dayData?.hasSlots && !dayData?.allBooked
                ? 'bg-green-50 text-green-700 hover:bg-green-100'
                : 'bg-gray-50 text-gray-300 cursor-not-allowed'
            )}
          >
            {format(day, 'd')}
          </button>
        );
      })}
    </div>
  );
}

Loading Optimization

Availability loads monthly and caches for 60 seconds. On date selection, time slots for specific day load. Cache invalidation via WebSocket event when new booking created.

Syncing Multiple Resources

For services with multiple specialists/rooms — select specific resource or show first available slot across all:

async function getFirstAvailableSlot(date: Date, serviceId: number): Promise<Slot | null> {
  const resources = await getServiceResources(serviceId);
  const slots = await Promise.all(
    resources.map(r => getAvailableSlots(r.id, date))
  );
  return slots.flat().sort((a, b) => a.datetime - b.datetime)[0] ?? null;
}

Timeframe

Availability calendar with API and component: 4–6 working days.