spatie / period

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

Make length() faster #42

Closed kylekatarnls closed 5 years ago

brendt commented 5 years ago

Thanks!

brendt commented 5 years ago

Tagged as 1.4.3: https://github.com/spatie/period/releases/tag/1.4.3

kylekatarnls commented 5 years ago

I PR it to 2.0 so it's not in 1.4.3: https://github.com/spatie/period/compare/1.4.2...1.4.3

kylekatarnls commented 5 years ago

For now in 1.4.3, it's optimized as length() is always returned as days count: https://github.com/spatie/period/blob/1.4.3/src/Period.php#L138

But of course it does not match iterator_count as it ignore the precision mask.

I would say, as a breaking change, this should not be in 1.x.

brendt commented 5 years ago

Oh, you're right.. My bad. No problem though, we'll merge it in when 2.0 arrives