spatie / period

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

Does this package only compares the dates, or does it also use the timestamp? #57

Closed MichMich closed 4 years ago

MichMich commented 4 years ago

Not sure based on the documentation. Does this package also work with time stamps, or does it only compare the dates? The examples only show dates, but since the period accepts DateTime objects, it might also work with time.

For example, would this work?

$a = Period::make('2020-01-01 12:00:00', '2020-01-01 14:00:00');
$a = Period::make('2020-01-01 16:00:00', '2020-01-01 18:00:00');

$overlap = $a->gap($b); // Period('2020-01-01 14:00:00', '2020-01-01 16:00:00')

Thanks!

MichMich commented 4 years ago

Figured out it can handle seconds by setting the precision. Thanks!