@datagica/find-free-time-slot

0.0.2 • Public • Published

@datagica/find-free-time-slot

Find a free time slot in a tight schedule

Installation

$ npm install --save @datagica/find-free-time-slot

Usage

import findFreeTimeSlot from "@datagica/find-free-time-slot";

findFreeTimeSlot([
  {from: DATE1, to: DATE2},
  {from: DATE3, to: DATE4}
]).then(result => {
  console.log("result: ", result)
}).catch(err => {
  console.log("invalid input data: "+err)
})

Examples

import findFreeTimeSlot from "@datagica/find-free-time-slot";

const now = moment().startOf('hour');

findFreeTimeSlot([
 {
   from: moment(now).add(1, 'hours'),
   to: moment(now).add(2, 'hours')
 },
 {
   from: moment(now).add(3, 'hours'),
   to: moment(now).add(4, 'hours')
 }
]).then(..).catch(..)
// will output the next date matching, for instance:
"2016-02-05T07:00:00.000Z"

Readme

Keywords

none

Package Sidebar

Install

npm i @datagica/find-free-time-slot

Weekly Downloads

1

Version

0.0.2

License

GPL-3.0

Last publish

Collaborators

  • datagica