### Install @gund/time-slots Source: https://github.com/gund/time-slots/blob/master/README.md Installs the core @gund/time-slots package using npm. ```bash npm install @gund/time-slots ``` -------------------------------- ### Install date-fns for adapter Source: https://github.com/gund/time-slots/blob/master/README.md Optionally installs the date-fns library to use its provided DateAdapter. ```bash npm install date-fns ``` -------------------------------- ### Provide date-fns DateAdapter Source: https://github.com/gund/time-slots/blob/master/README.md Configures the library to use the date-fns adapter for date and time manipulations. This simplifies setup if date-fns is already a project dependency. ```javascript import { provideDateAdapter } from '@gund/time-slots'; import { dateFnsAdapter } from '@gund/time-slots/date-adapter/date-fns'; provideDateAdapter(dateFnsAdapter); ``` -------------------------------- ### Build Project Source: https://github.com/gund/time-slots/blob/master/README.md Builds the project artifacts, typically for deployment. The `--prod` flag can be used for production builds. ```bash nx build --prod ``` -------------------------------- ### View Dependency Graph Source: https://github.com/gund/time-slots/blob/master/README.md Generates a visual representation of the project's dependencies, helping to understand the workspace structure. ```bash nx dep-graph ``` -------------------------------- ### Run Unit Tests Source: https://github.com/gund/time-slots/blob/master/packages/time-slots/README.md Executes the unit tests for the time-slots library using Jest. ```bash nx test time-slots ``` -------------------------------- ### Provide DateAdapter Source: https://github.com/gund/time-slots/blob/master/README.md Sets up the necessary DateAdapter for the library's date operations. This is a required step before using the library's core functionalities. ```javascript import { provideDateAdapter } from '@gund/time-slots'; provideDateAdapter(...); // Your DateAdapter is here ``` -------------------------------- ### Run Unit Tests Source: https://github.com/gund/time-slots/blob/master/README.md Executes all unit tests in the project using Jest. For testing only changed files, use `nx affected:test`. ```bash nx test nx affected:test ``` -------------------------------- ### Generate Time Slots with Interval Source: https://github.com/gund/time-slots/blob/master/README.md Generates time slots within a date and time range, sliced into specified time intervals. This allows for granular scheduling, such as 30-minute slots. ```javascript import { generateTimeSlots, DateRange, TimeRange, TimeInterval, } from '@gund/time-slots'; const slots = generateTimeSlots( DateRange.fromDates(new Date(2020, 10, 15), new Date(2020, 10, 16)), TimeRange.fromTimeStrings('9:00', '17:30'), TimeInterval.minutes(30), ); // Now slots will contain array of `TimeRange` // between 15.11.2020 to 20.11.2020 // with every day sliced in 30 mins intervals from 9am till 5:30pm console.log(slots); ``` -------------------------------- ### Generate Time Slots Source: https://github.com/gund/time-slots/blob/master/README.md Generates an array of time slots within a specified date range and time range. This function is the core utility for creating time slot schedules. ```javascript import { generateTimeSlots, DateRange, TimeRange } from '@gund/time-slots'; const slots = generateTimeSlots( DateRange.fromDates(new Date(2020, 10, 15), new Date(2020, 10, 20)), TimeRange.fromTimeStrings('9:00', '17:30'), ); // Now slots will contain array of `TimeRange` // between 15.11.2020 to 20.11.2020 // with every day from 9am till 5:30pm console.log(slots); ``` -------------------------------- ### Exclude Booked Time Slots Source: https://github.com/gund/time-slots/blob/master/README.md Removes time slots from a primary list that intersect with a secondary list of booked slots. This is useful for finding available time slots. ```javascript import { excludeTimeSlots } from '@gund/time-slots'; const allSlots = [...]; const bookedSlots = [...]; const availableSlots = excludeTimeSlots(allSlots, bookedSlots); // Result will have only slots from `allSlots` that // do not intersect with any slots in `bookedSlots` console.log(availableSlots); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.