1.0.0 • Published 1 year ago

timeslot-ts v1.0.0

Weekly downloads
4
License
BSD-2-Clause
Repository
github
Last release
1 year ago

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