Resource availability & assignment
Check whether a proposed assignment fits the resource's working intervals and blackout ranges. Built-in rules and an optional application approval hook explain why a selection or mutation is accepted or rejected.
Loading interactive demo…
What you configure
- availability.workingHours
- Define resource-specific working weekdays and time intervals.
- availability.unavailable
- Add exact unavailable ranges and optional reasons.
- resourceAssignmentAllow
- Run application approval after built-in synchronous checks pass.
Essential integration
This assumes the shared Quick start already provides premiumLicense and, for UI views, premiumCalendarOptions. Only the feature-specific setup is shown.
import { WtsCalendar } from '@wts-calendar/core';
import { resourceSchedulingModule } from '@wts-calendar/core/resource-scheduling';
const calendar = new WtsCalendar({
...premiumCalendarOptions,
plugins: [resourceSchedulingModule],
view: 'resource-time-grid-day',
resources: [
{
id: 'design',
title: 'Design studio',
capacity: 2,
availability: {
workingHours: {
daysOfWeek: [1, 2, 3, 4, 5],
startTime: '09:00',
endTime: '17:00',
},
unavailable: [
{ start: '2026-09-07T12:00:00Z', end: '2026-09-07T13:00:00Z', reason: 'Lunch' },
],
},
},
],
events: [
{
id: 'review',
title: 'Design review',
resourceId: 'design',
start: '2026-09-07T09:00:00Z',
end: '2026-09-07T10:30:00Z',
},
],
});
export function assignLunchBooking() {
try {
calendar.addEvent({
id: 'lunch',
title: 'Proposed booking',
resourceId: 'design',
start: '2026-09-07T12:00:00Z',
end: '2026-09-07T12:30:00Z',
});
} catch (error) {
// Display the validation error; do not silently discard the user's edit.
return error instanceof Error ? error.message : String(error);
}
return 'Booking accepted';
}Behavior and lifecycle
- Timed assignments must fit within one working interval; all-day assignments require an allowed weekday.
- An unavailable-range intersection rejects the assignment, and asynchronous validation uses the pending/rollback lifecycle.
Limits and responsibilities
- Client-side checks are not a reservation lock across simultaneous users.
- An authoritative backend must revalidate availability before committing shared bookings.
Premium
Enable this capability
- Optional module
- @wts-calendar/core/resource-scheduling
- Local capability ID
- resource-scheduling · enabled by package-wide Premium
Use the request form to describe your project and deployment origins. Pricing and terms are confirmed privately. A WTS license is separate from provider credentials; do not send passwords or production access tokens.
The live example uses a browser-visible deployment key restricted to this package and approved origins. It does not collect license keys or visitor credentials.