spatie / period

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

Possible bug in PeriodCollection gaps() #58

Closed jonagoldman closed 4 years ago

jonagoldman commented 4 years ago

Given two equal periods with boundaries:

$collection = new PeriodCollection(
    Period::make('2018-01-01', '2018-01-03', null, Boundaries::EXCLUDE_END),
    Period::make('2018-01-01', '2018-01-03', null, Boundaries::EXCLUDE_END)
);

$gaps = $collection->gaps();

I expected gaps to return 0 periods, but I get 1 period instead:

// $gaps->count() == 1
// $period->getStart() == '2018-01-03'
// $period->getEnd() == '2018-01-03'

Is this expected?

brendt commented 4 years ago

That's a valid bug. I'll look into it this week.

brendt commented 4 years ago

Fixed with 1.4.5: https://github.com/spatie/period/releases/tag/1.4.5

It'll probably take a few minutes before packagist knows about this new tag.

jonagoldman commented 4 years ago

Wow that was fast! Thanks!