spatie / period

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

Let length() use the Period's precision #24

Closed jeromegamez closed 5 years ago

jeromegamez commented 5 years ago

Replaces #21 (same contents, but more fitting branch name 🤷‍♂️)

:octocat:

brendt commented 5 years ago

Awesome! Let's discuss other new features in #22 !

kylekatarnls commented 5 years ago

iterator_count proceeds the whole iteration (that can be very long). A faster approches would be to use the diff but get the unit according to the precisionMask.

See the code:

Period::make('2000-01-01', '2100-01-01')->length();

Right now it takes 1.50ms. With iterator_count: 22.54ms

brendt commented 5 years ago

Are you able to submit a PR for this?

kylekatarnls commented 5 years ago

Yep, please assign it to me, so it will be in my todo-filter.

brendt commented 5 years ago

Cool, appreciate it!

kylekatarnls commented 5 years ago

See #42