timeslot-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

timeslot-ts

Whitelist and blacklist time slots for booking/scheduling system

npm Package Version

Example

import { flattenSlots, isAvailable, MINUTE } from 'timeslot-ts'

let interval = 30 * MINUTE

let slots = flattenSlots({
  whitelistSlots: [
    { start: '09:00', end: '10:30' },
    { start: '14:00', end: '16:30' },
  ],
  interval, // optional, default is one MINUTE
})

let canBook = isAvailable(slots, {
  start: '15:00',
  end: '15:30',
  interval, // optional, default is one MINUTE
})

console.log(canBook) // true

More usage examples can refer to core.spec.ts

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others

Package Sidebar

Install

npm i timeslot-ts

Weekly Downloads

13

Version

1.0.0

License

BSD-2-Clause

Unpacked Size

26.6 kB

Total Files

19

Last publish

Collaborators

  • beenotung