spatie / period

Complex period comparisons
https://spatie.be/open-source
MIT License
1.59k stars 72 forks source link

Multiple gaps support #2

Closed brendt closed 5 years ago

brendt commented 5 years ago

We want to calculate multiple gaps like so:

/*
 * A                   [====]
 * B                               [========]
 * C         [=====]
 * D                                             [====]
 *
 * GAPS             [=]      [====]          [==]
 */

The method should be called gaps, accept n-amount of periods and calculate all the gaps.

This can be done by creating a period with the most left and right boundaries, and diffing that period against all others.

brendt commented 5 years ago

It's supported on PeriodCollection now.