Algebraic operations for time intervals.
$ npm install @smhg/date-interval
import Interval from '@smhg/date-interval';
// with ISO 8601 string
let interval1 = Interval('2015-08-03T12:00:00Z/2015-08-04T12:00:00Z');
// with 2 dates
let interval2 = Interval(new Date('2015-08-03T12:00:00Z'), new Date('2015-08-04T12:00:00Z'));
Pass an ISO 8601 time interval formatted string to create an interval.
Pass a start and end Date object to create an interval.
Returns the interval as an ISO 8601 formatted string.
Returns whether both intervals overlap.
Returns an array with the result of a merge of both intervals.
Returns an array with the difference of both intervals.
Returns the interval that lies at the intersection of both intervals (if any).