BEILOFF Toolkit / v1.1.1

Booking calendar export

Give a customer an “Add to calendar” download as soon as a booking is confirmed. The module puts the time, location and details into one .ics file.

How the kit works

Map a booking

Pass a persistent UID, a title, a start and an end as Date objects. The module serializes the times in UTC. Location, description and revision time are optional.

Generate the file

createCalendarEvent returns a VCALENDAR string with one VEVENT. It preserves description line breaks, escapes text delimiters and folds long UTF-8 lines at character boundaries.

Import the event

Offer the file on the booking confirmation page. Import displays the event in the calendar’s own time zone. The included example is a consultation running from 09:00 to 09:30 UTC.

Inside the ZIP

  • README.md
  • calendar.mjs
  • example.mjs
  • booking.mjs
  • server.mjs
  • booking.ics
  • calendar.test.mjs
  • RELEASE.txt

Each file describes one timed event. Import creates a snapshot. This edition does not provide subscriptions, attendee invitations, recurring events or all-day events.

Getting started

  1. With Node.js 24, run node server.mjs and open the URL it prints. Select English and click Add to calendar on the confirmation page. You can also open the included booking.ics without a server.
  2. Copy calendar.mjs into your project and import createCalendarEvent. The object in booking.mjs shows every supported field. Keep one globally unique UID per booking.
  3. Move the /booking.ics handler from server.mjs into your app. It sets the text/calendar content type and names the attachment booking.ics. Use your app’s existing authorization for personal bookings.

Change the colours and logo

Edit text, background and link colours in the style block in server.mjs. Place a logo image with alt text at the start of main and use a reachable image URL. Restart the server and check both languages. The recipient’s calendar sets the imported event’s appearance.

Verify the result

Run node --test calendar.test.mjs. The suite checks UTC timestamps, Unicode text, octet limits, required fields and duration. Open the generated file and compare its displayed time with your original booking.

RFC 5545 · iCalendar

Release notes

v1.1.1

Added colour and logo customisation instructions to the README.

v1.1.0

Added a booking confirmation page with an Add to calendar link and a working Node.js download handler. Moved the sample record into booking.mjs.

v1.0.0

First edition with single-event export, a sample booking and tests for time, text and invalid input.

Download free in my account