time-gaps
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

time-gaps

A simple module for working with time intervals

Installation

$ npm install time-gaps

Usage

const timeGaps = require('time-gaps');

Example

const timeGaps = require('time-gaps');

// previously available intervals
const oldIntervals = [{
  from: '2015-08-03T13:00:00.000Z',
  to: '2015-08-03T13:30:00.000Z',
}, {
  from: '2015-08-03T14:00:00.000Z',
  to: '2015-08-03T14:30:00.000Z',
}];

const newIntervals = [{
  from: '2015-08-03T12:45:00.000Z',
  to: '2015-08-03T13:15:00.000Z',
}];

const mergedIntervals = timeGaps.megre(newIntervals, oldIntervals);
/*
[
  {
    from: '2015-08-03T12:45:00.000Z',
    to: '2015-08-03T13:00:00.000Z',
  },
  {
    from: '2015-08-03T13:00:00.000Z',
    to: '2015-08-03T13:30:00.000Z',
  },
  {
    from: '2015-08-03T14:00:00.000Z',
    to: '2015-08-03T14:30:00.000Z',
  },
] */

Readme

Keywords

Package Sidebar

Install

npm i time-gaps

Weekly Downloads

1

Version

1.1.7

License

Apache-2.0

Unpacked Size

40.1 kB

Total Files

10

Last publish

Collaborators

  • vkryuchkov