@datagica/find-free-time-slot
v0.0.2
Published
Find a free time slot in a tight schedule
Downloads
4
Readme
@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"