← Back to projects
PROJECT / 01Applications & services
Service website & bookings
A booking example for an independent professional.
WEB PROTOTYPE
Choose a service, a future date and a time. The confirmation exists only in this demo; no real appointment is booked.
REQUEST PREVIEW
Request summary
Choose a date to create a sample request.
No booking is sent or saved.
View concept code
export function booking(data, min) {
const duration = { review: 45, planning: 60 }[data.service];
const match = /^\d{4}-\d{2}-\d{2}$/.test(data.date || '');
const parsed = new Date(data.date + 'T12:00:00Z');
if (
!duration ||
!match ||
Number.isNaN(parsed.getTime()) ||
parsed.toISOString().slice(0, 10) !== data.date ||
data.date < min ||
!['09:00', '11:00', '15:00', '17:00'].includes(data.time)
)
throw Error('Invalid booking');
return { ...data, duration, simulated: true };
}