spatie / period

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

Returns PeriodCollection with null element #14

Closed Lednick closed 5 years ago

Lednick commented 5 years ago

When I try to use PeriodCollection's function isEmpty this return false, but when i dump

screen shot 2019-01-08 at 12 20 40 pm

I have that:

screen shot 2019-01-08 at 12 20 32 pm

So method isEmpty works not right, because array only with one null element.

Here in my code:

screen shot 2019-01-08 at 12 25 25 pm

Can you fix this issue?

brendt commented 5 years ago

Can you share the concrete values of $dateFrom, $dateTo, $compareDateFrom and $compareDateTo ?

Lednick commented 5 years ago

$dateFrom = 2019-01-08 12:32:49.0 UTC (+00:00) $dateTo = 2019-01-31 12:32:49.0 UTC (+00:00) $compareDateFrom = 2019-03-09 10:15:52.0 UTC (+00:00) $compareDateTo = 2019-06-22 10:15:52.0 UTC (+00:00)

brendt commented 5 years ago

Fixed in 0.4.1: https://github.com/spatie/period/releases/tag/0.4.1